Commit f5a322d80b32493294a87eb4bfa0c17864c14371

Authored by perry.werneck@gmail.com
1 parent 9d5150d1

Android - Implementando string de logon para passar automaticamente pela tela inicial

Showing 4 changed files with 18 additions and 17 deletions   Show diff stats
ctlr.c
... ... @@ -240,7 +240,6 @@ static void set_formatted(H3270 *hSession, int state)
240 240 hSession->update_formatted(hSession,hSession->formatted);
241 241 }
242 242 */
243   - trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted");
244 243 }
245 244  
246 245 /**
... ... @@ -366,12 +365,7 @@ unsigned char get_field_attribute(H3270 *hSession, int baddr)
366 365 return hSession->ea_buf[find_field_attribute(hSession,baddr)].fa;
367 366 }
368 367  
369   -/*
370   - * Find the next unprotected field. Returns the address following the
371   - * unprotected attribute byte, or 0 if no nonzero-width unprotected field
372   - * can be found.
373   - */
374   -int next_unprotected(H3270 *hSession, int baddr0)
  368 +LIB3270_EXPORT int lib3270_get_next_unprotected(H3270 *hSession, int baddr0)
375 369 {
376 370 register int baddr, nbaddr;
377 371  
... ...
ctlrc.h
... ... @@ -61,7 +61,9 @@ LIB3270_INTERNAL enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int b
61 61 LIB3270_INTERNAL void ctlr_write_sscp_lu(H3270 *session, unsigned char buf[], int buflen);
62 62 LIB3270_INTERNAL void mdt_clear(H3270 *hSession, int baddr);
63 63 LIB3270_INTERNAL void mdt_set(H3270 *hSession, int baddr);
64   -LIB3270_INTERNAL int next_unprotected(H3270 *session, int baddr0);
  64 +
  65 +#define next_unprotected(session, baddr0) lib3270_get_next_unprotected(session, baddr0)
  66 +
65 67 LIB3270_INTERNAL enum pds process_ds(H3270 *hSession, unsigned char *buf, int buflen);
66 68 LIB3270_INTERNAL void ps_process(H3270 *hSession);
67 69  
... ...
kybd.c
... ... @@ -86,7 +86,9 @@ struct ta;
86 86 #include "api.h"
87 87  
88 88  
89   -/*#define KYBDLOCK_TRACE 1*/
  89 +#ifdef DEBUG
  90 + #define KYBDLOCK_TRACE
  91 +#endif // DEBUG
90 92  
91 93 /* Statics */
92 94 // static enum { NONE, COMPOSE, FIRST } composing = NONE;
... ... @@ -372,12 +374,9 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits)
372 374 n = hSession->kybdlock | bits;
373 375 if (n != hSession->kybdlock)
374 376 {
375   -/*
376 377 #if defined(KYBDLOCK_TRACE)
377   - lib3270_trace_event(hSession," %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n",
378   - cause, bits, kybdlock, n);
  378 + lib3270_trace_event(hSession," %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", "set", bits, hSession->kybdlock, n);
379 379 #endif
380   -*/
381 380 if ((hSession->kybdlock ^ bits) & KL_DEFERRED_UNLOCK)
382 381 {
383 382 /* Turned on deferred unlock. */
... ... @@ -396,10 +395,12 @@ void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits)
396 395 {
397 396 unsigned int n = hSession->kybdlock & ~( (unsigned int) bits);
398 397  
  398 + trace("%s: kybdlock=%d",__FUNCTION__,n);
  399 +
399 400 if (n != hSession->kybdlock)
400 401 {
401 402 #if defined(KYBDLOCK_TRACE)
402   - lib3270_trace_event(hSession," %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", __FUNCTION__, bits, kybdlock, n);
  403 + lib3270_trace_event(hSession," %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n", "clear", bits, hSession->kybdlock, n);
403 404 #endif
404 405 if ((hSession->kybdlock ^ n) & KL_DEFERRED_UNLOCK)
405 406 {
... ... @@ -2502,7 +2503,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len
2502 2503 len = mb_to_unicode(s, len, w_ibuf, w_ibuf_len, NULL);
2503 2504 if (len < 0)
2504 2505 {
2505   - return 0; /* failed */
  2506 + return -1; /* failed */
2506 2507 }
2507 2508 ws = w_ibuf;
2508 2509 #else /*][*/
... ... @@ -2523,7 +2524,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len
2523 2524 if (hSession->kybdlock)
2524 2525 {
2525 2526 lib3270_trace_event(hSession," keyboard locked, string dropped\n");
2526   - return 0;
  2527 + return -1;
2527 2528 }
2528 2529  
2529 2530 if (pasting && IN_3270)
... ...
screen.c
... ... @@ -372,10 +372,14 @@ void screen_update(H3270 *session, int bstart, int bend)
372 372 session->changed(session,first,len);
373 373 }
374 374  
375   - if(session->starting && session->formatted && lib3270_in_3270(session))
  375 + if(session->starting && session->formatted && !session->kybdlock && lib3270_in_3270(session))
376 376 {
377 377 session->starting = 0;
  378 +
  379 +// cursor_move(session,next_unprotected(session,0));
  380 +// lib3270_emulate_input(session,"\\n",-1,0);
378 381 session->autostart(session);
  382 +
379 383 #ifdef DEBUG
380 384 {
381 385 char *text = lib3270_get_text(session,0,-1);
... ...