From f5a322d80b32493294a87eb4bfa0c17864c14371 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Fri, 31 Aug 2012 17:33:43 +0000 Subject: [PATCH] Android - Implementando string de logon para passar automaticamente pela tela inicial --- ctlr.c | 8 +------- ctlrc.h | 4 +++- kybd.c | 17 +++++++++-------- screen.c | 6 +++++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ctlr.c b/ctlr.c index 678abd8..752cbab 100644 --- a/ctlr.c +++ b/ctlr.c @@ -240,7 +240,6 @@ static void set_formatted(H3270 *hSession, int state) hSession->update_formatted(hSession,hSession->formatted); } */ - trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); } /** @@ -366,12 +365,7 @@ unsigned char get_field_attribute(H3270 *hSession, int baddr) return hSession->ea_buf[find_field_attribute(hSession,baddr)].fa; } -/* - * Find the next unprotected field. Returns the address following the - * unprotected attribute byte, or 0 if no nonzero-width unprotected field - * can be found. - */ -int next_unprotected(H3270 *hSession, int baddr0) +LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0) { register int baddr, nbaddr; diff --git a/ctlrc.h b/ctlrc.h index 6f8fac1..eddd59c 100644 --- a/ctlrc.h +++ b/ctlrc.h @@ -61,7 +61,9 @@ LIB3270_INTERNAL enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int b LIB3270_INTERNAL void ctlr_write_sscp_lu(H3270 *session, unsigned char buf[], int buflen); LIB3270_INTERNAL void mdt_clear(H3270 *hSession, int baddr); LIB3270_INTERNAL void mdt_set(H3270 *hSession, int baddr); -LIB3270_INTERNAL int next_unprotected(H3270 *session, int baddr0); + +#define next_unprotected(session, baddr0) lib3270_get_next_unprotected(session, baddr0) + LIB3270_INTERNAL enum pds process_ds(H3270 *hSession, unsigned char *buf, int buflen); LIB3270_INTERNAL void ps_process(H3270 *hSession); diff --git a/kybd.c b/kybd.c index abcb250..dab3c92 100644 --- a/kybd.c +++ b/kybd.c @@ -86,7 +86,9 @@ struct ta; #include "api.h" -/*#define KYBDLOCK_TRACE 1*/ +#ifdef DEBUG + #define KYBDLOCK_TRACE +#endif // DEBUG /* Statics */ // static enum { NONE, COMPOSE, FIRST } composing = NONE; @@ -372,12 +374,9 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits) n = hSession->kybdlock | bits; if (n != hSession->kybdlock) { -/* #if defined(KYBDLOCK_TRACE) - lib3270_trace_event(hSession," %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", - cause, bits, kybdlock, n); + lib3270_trace_event(hSession," %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", "set", bits, hSession->kybdlock, n); #endif -*/ if ((hSession->kybdlock ^ bits) & KL_DEFERRED_UNLOCK) { /* Turned on deferred unlock. */ @@ -396,10 +395,12 @@ void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits) { unsigned int n = hSession->kybdlock & ~( (unsigned int) bits); + trace("%s: kybdlock=%d",__FUNCTION__,n); + if (n != hSession->kybdlock) { #if defined(KYBDLOCK_TRACE) - lib3270_trace_event(hSession," %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", __FUNCTION__, bits, kybdlock, n); + lib3270_trace_event(hSession," %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", "clear", bits, hSession->kybdlock, n); #endif if ((hSession->kybdlock ^ n) & KL_DEFERRED_UNLOCK) { @@ -2502,7 +2503,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len len = mb_to_unicode(s, len, w_ibuf, w_ibuf_len, NULL); if (len < 0) { - return 0; /* failed */ + return -1; /* failed */ } ws = w_ibuf; #else /*][*/ @@ -2523,7 +2524,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len if (hSession->kybdlock) { lib3270_trace_event(hSession," keyboard locked, string dropped\n"); - return 0; + return -1; } if (pasting && IN_3270) diff --git a/screen.c b/screen.c index cdb3714..7ef6e9c 100644 --- a/screen.c +++ b/screen.c @@ -372,10 +372,14 @@ void screen_update(H3270 *session, int bstart, int bend) session->changed(session,first,len); } - if(session->starting && session->formatted && lib3270_in_3270(session)) + if(session->starting && session->formatted && !session->kybdlock && lib3270_in_3270(session)) { session->starting = 0; + +// cursor_move(session,next_unprotected(session,0)); +// lib3270_emulate_input(session,"\\n",-1,0); session->autostart(session); + #ifdef DEBUG { char *text = lib3270_get_text(session,0,-1); -- libgit2 0.21.2