Commit f3aab14f435a25f9cf8675faa0906724df03f2af

Authored by perry.werneck@gmail.com
1 parent 9230ba51

Movendo mais campos para a estrutura de sessao

@@ -307,7 +307,7 @@ static void ctlr_connect(H3270 *session, int ignored unused, void *dunno) @@ -307,7 +307,7 @@ static void ctlr_connect(H3270 *session, int ignored unused, void *dunno)
307 session->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; 307 session->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY;
308 else 308 else
309 session->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; 309 session->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT;
310 - if (!IN_3270 || (IN_SSCP && (kybdlock & KL_OIA_TWAIT))) 310 + if (!IN_3270 || (IN_SSCP && (session->kybdlock & KL_OIA_TWAIT)))
311 { 311 {
312 kybdlock_clr(KL_OIA_TWAIT, "ctlr_connect"); 312 kybdlock_clr(KL_OIA_TWAIT, "ctlr_connect");
313 status_reset(session); 313 status_reset(session);
@@ -1106,7 +1106,7 @@ ctlr_erase_all_unprotected(void) @@ -1106,7 +1106,7 @@ ctlr_erase_all_unprotected(void)
1106 ctlr_clear(&h3270,True); 1106 ctlr_clear(&h3270,True);
1107 } 1107 }
1108 aid = AID_NO; 1108 aid = AID_NO;
1109 - do_reset(False); 1109 + do_reset(&h3270,False);
1110 ALL_CHANGED; 1110 ALL_CHANGED;
1111 } 1111 }
1112 1112
@@ -1863,10 +1863,10 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) @@ -1863,10 +1863,10 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
1863 trace_ds("\n"); 1863 trace_ds("\n");
1864 if (wcc_keyboard_restore) { 1864 if (wcc_keyboard_restore) {
1865 aid = AID_NO; 1865 aid = AID_NO;
1866 - do_reset(False);  
1867 - } else if (kybdlock & KL_OIA_TWAIT) { 1866 + do_reset(&h3270,False);
  1867 + } else if (h3270.kybdlock & KL_OIA_TWAIT) {
1868 kybdlock_clr(KL_OIA_TWAIT, "ctlr_write"); 1868 kybdlock_clr(KL_OIA_TWAIT, "ctlr_write");
1869 - status_syswait(); 1869 + status_changed(&h3270,LIB3270_STATUS_SYSWAIT);
1870 } 1870 }
1871 if (wcc_sound_alarm) 1871 if (wcc_sound_alarm)
1872 lib3270_ring_bell(NULL); 1872 lib3270_ring_bell(NULL);
@@ -1987,7 +1987,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) @@ -1987,7 +1987,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen)
1987 1987
1988 /* Unlock the keyboard. */ 1988 /* Unlock the keyboard. */
1989 aid = AID_NO; 1989 aid = AID_NO;
1990 - do_reset(False); 1990 + do_reset(&h3270,False);
1991 1991
1992 } 1992 }
1993 1993
@@ -2286,7 +2286,7 @@ ps_process(void) @@ -2286,7 +2286,7 @@ ps_process(void)
2286 if (lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE && /* transfer in progress */ 2286 if (lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE && /* transfer in progress */
2287 h3270.formatted && /* screen is formatted */ 2287 h3270.formatted && /* screen is formatted */
2288 !h3270.screen_alt && /* 24x80 screen */ 2288 !h3270.screen_alt && /* 24x80 screen */
2289 - !kybdlock && /* keyboard not locked */ 2289 + !h3270.kybdlock && /* keyboard not locked */
2290 /* magic field */ 2290 /* magic field */
2291 h3270.ea_buf[1919].fa && FA_IS_SKIP(h3270.ea_buf[1919].fa)) { 2291 h3270.ea_buf[1919].fa && FA_IS_SKIP(h3270.ea_buf[1919].fa)) {
2292 ft_cut_data(); 2292 ft_cut_data();
@@ -132,7 +132,7 @@ static struct xks { @@ -132,7 +132,7 @@ static struct xks {
132 static Boolean reverse = False; /* reverse-input mode */ 132 static Boolean reverse = False; /* reverse-input mode */
133 133
134 /* Globals */ 134 /* Globals */
135 -unsigned int kybdlock = KL_NOT_CONNECTED; 135 +// unsigned int kybdlock = KL_NOT_CONNECTED;
136 unsigned char aid = AID_NO; /* current attention ID */ 136 unsigned char aid = AID_NO; /* current attention ID */
137 137
138 /* Composite key mappings. */ 138 /* Composite key mappings. */
@@ -175,7 +175,7 @@ static struct ta @@ -175,7 +175,7 @@ static struct ta
175 175
176 static const char dxl[] = "0123456789abcdef"; 176 static const char dxl[] = "0123456789abcdef";
177 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl) 177 #define FROM_HEX(c) (strchr(dxl, tolower(c)) - dxl)
178 -#define KYBDLOCK_IS_OERR (kybdlock && !(kybdlock & ~KL_OERR_MASK)) 178 +#define KYBDLOCK_IS_OERR (h3270.kybdlock && !(h3270.kybdlock & ~KL_OERR_MASK))
179 179
180 180
181 /* 181 /*
@@ -191,7 +191,7 @@ static int enq_chk(void) @@ -191,7 +191,7 @@ static int enq_chk(void)
191 } 191 }
192 192
193 /* If operator error, complain and drop it. */ 193 /* If operator error, complain and drop it. */
194 - if (kybdlock & KL_OERR_MASK) 194 + if (h3270.kybdlock & KL_OERR_MASK)
195 { 195 {
196 lib3270_ring_bell(NULL); 196 lib3270_ring_bell(NULL);
197 trace_event(" dropped (operator error)\n"); 197 trace_event(" dropped (operator error)\n");
@@ -199,9 +199,9 @@ static int enq_chk(void) @@ -199,9 +199,9 @@ static int enq_chk(void)
199 } 199 }
200 200
201 /* If scroll lock, complain and drop it. */ 201 /* If scroll lock, complain and drop it. */
202 - if (kybdlock & KL_SCROLLED) 202 + if (h3270.kybdlock & KL_SCROLLED)
203 { 203 {
204 - lib3270_ring_bell(NULL); 204 + lib3270_ring_bell(&h3270);
205 trace_event(" dropped (scrolled)\n"); 205 trace_event(" dropped (scrolled)\n");
206 return -1; 206 return -1;
207 } 207 }
@@ -244,7 +244,7 @@ static int enq_chk(void) @@ -244,7 +244,7 @@ static int enq_chk(void)
244 } 244 }
245 ta_tail = ta; 245 ta_tail = ta;
246 246
247 - trace_event(" Key-aid queued (kybdlock 0x%x)\n", kybdlock); 247 + trace_event(" Key-aid queued (kybdlock 0x%x)\n", h3270.kybdlock);
248 } 248 }
249 249
250 /* 250 /*
@@ -282,7 +282,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char @@ -282,7 +282,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char
282 } 282 }
283 ta_tail = ta; 283 ta_tail = ta;
284 284
285 - trace_event(" action queued (kybdlock 0x%x)\n", kybdlock); 285 + trace_event(" action queued (kybdlock 0x%x)\n", h3270.kybdlock);
286 } 286 }
287 287
288 /* 288 /*
@@ -292,7 +292,7 @@ Boolean run_ta(void) @@ -292,7 +292,7 @@ Boolean run_ta(void)
292 { 292 {
293 struct ta *ta; 293 struct ta *ta;
294 294
295 - if (kybdlock || (ta = ta_head) == (struct ta *)NULL) 295 + if (h3270.kybdlock || (ta = ta_head) == (struct ta *)NULL)
296 return False; 296 return False;
297 297
298 if ((ta_head = ta->next) == (struct ta *)NULL) 298 if ((ta_head = ta->next) == (struct ta *)NULL)
@@ -353,18 +353,18 @@ kybdlock_set(unsigned int bits, const char *cause unused) @@ -353,18 +353,18 @@ kybdlock_set(unsigned int bits, const char *cause unused)
353 { 353 {
354 unsigned int n; 354 unsigned int n;
355 355
356 - n = kybdlock | bits;  
357 - if (n != kybdlock) { 356 + n = h3270.kybdlock | bits;
  357 + if (n != h3270.kybdlock) {
358 #if defined(KYBDLOCK_TRACE) /*[*/ 358 #if defined(KYBDLOCK_TRACE) /*[*/
359 trace_event(" %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n", 359 trace_event(" %s: kybdlock |= 0x%04x, 0x%04x -> 0x%04x\n",
360 cause, bits, kybdlock, n); 360 cause, bits, kybdlock, n);
361 #endif /*]*/ 361 #endif /*]*/
362 - if ((kybdlock ^ bits) & KL_DEFERRED_UNLOCK) { 362 + if ((h3270.kybdlock ^ bits) & KL_DEFERRED_UNLOCK) {
363 /* Turned on deferred unlock. */ 363 /* Turned on deferred unlock. */
364 unlock_delay_time = time(NULL); 364 unlock_delay_time = time(NULL);
365 } 365 }
366 - kybdlock = n;  
367 - status_kybdlock(); 366 + h3270.kybdlock = n;
  367 + status_changed(&h3270,LIB3270_STATUS_KYBDLOCK);
368 } 368 }
369 } 369 }
370 370
@@ -374,18 +374,17 @@ kybdlock_clr(unsigned int bits, const char *cause unused) @@ -374,18 +374,17 @@ kybdlock_clr(unsigned int bits, const char *cause unused)
374 { 374 {
375 unsigned int n; 375 unsigned int n;
376 376
377 - n = kybdlock & ~bits;  
378 - if (n != kybdlock) {  
379 -#if defined(KYBDLOCK_TRACE) /*[*/  
380 - trace_event(" %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n",  
381 - cause, bits, kybdlock, n);  
382 -#endif /*]*/  
383 - if ((kybdlock ^ n) & KL_DEFERRED_UNLOCK) { 377 + n = h3270.kybdlock & ~bits;
  378 + if (n != h3270.kybdlock) {
  379 +#if defined(KYBDLOCK_TRACE)
  380 + trace_event(" %s: kybdlock &= ~0x%04x, 0x%04x -> 0x%04x\n",cause, bits, kybdlock, n);
  381 +#endif
  382 + if ((h3270.kybdlock ^ n) & KL_DEFERRED_UNLOCK) {
384 /* Turned off deferred unlock. */ 383 /* Turned off deferred unlock. */
385 unlock_delay_time = 0; 384 unlock_delay_time = 0;
386 } 385 }
387 - kybdlock = n;  
388 - status_kybdlock(); 386 + h3270.kybdlock = n;
  387 + status_changed(&h3270,LIB3270_STATUS_KYBDLOCK);
389 } 388 }
390 } 389 }
391 390
@@ -397,11 +396,11 @@ kybd_inhibit(Boolean inhibit) @@ -397,11 +396,11 @@ kybd_inhibit(Boolean inhibit)
397 { 396 {
398 if (inhibit) { 397 if (inhibit) {
399 kybdlock_set(KL_ENTER_INHIBIT, "kybd_inhibit"); 398 kybdlock_set(KL_ENTER_INHIBIT, "kybd_inhibit");
400 - if (kybdlock == KL_ENTER_INHIBIT) 399 + if (h3270.kybdlock == KL_ENTER_INHIBIT)
401 status_reset(&h3270); 400 status_reset(&h3270);
402 } else { 401 } else {
403 kybdlock_clr(KL_ENTER_INHIBIT, "kybd_inhibit"); 402 kybdlock_clr(KL_ENTER_INHIBIT, "kybd_inhibit");
404 - if (!kybdlock) 403 + if (!h3270.kybdlock)
405 status_reset(&h3270); 404 status_reset(&h3270);
406 } 405 }
407 } 406 }
@@ -411,7 +410,7 @@ kybd_inhibit(Boolean inhibit) @@ -411,7 +410,7 @@ kybd_inhibit(Boolean inhibit)
411 */ 410 */
412 void kybd_connect(H3270 *session, int connected, void *dunno) 411 void kybd_connect(H3270 *session, int connected, void *dunno)
413 { 412 {
414 - if (kybdlock & KL_DEFERRED_UNLOCK) 413 + if (session->kybdlock & KL_DEFERRED_UNLOCK)
415 RemoveTimeOut(unlock_id); 414 RemoveTimeOut(unlock_id);
416 415
417 kybdlock_clr(-1, "kybd_connect"); 416 kybdlock_clr(-1, "kybd_connect");
@@ -430,7 +429,7 @@ void kybd_connect(H3270 *session, int connected, void *dunno) @@ -430,7 +429,7 @@ void kybd_connect(H3270 *session, int connected, void *dunno)
430 */ 429 */
431 void kybd_in3270(H3270 *session, int in3270 unused, void *dunno) 430 void kybd_in3270(H3270 *session, int in3270 unused, void *dunno)
432 { 431 {
433 - if (kybdlock & KL_DEFERRED_UNLOCK) 432 + if (session->kybdlock & KL_DEFERRED_UNLOCK)
434 RemoveTimeOut(unlock_id); 433 RemoveTimeOut(unlock_id);
435 kybdlock_clr(~KL_AWAITING_FIRST, "kybd_in3270"); 434 kybdlock_clr(~KL_AWAITING_FIRST, "kybd_in3270");
436 435
@@ -523,10 +522,10 @@ static void key_AID(H3270 *session, unsigned char aid_code) @@ -523,10 +522,10 @@ static void key_AID(H3270 *session, unsigned char aid_code)
523 trace("IN_SSCP: %d cursor_addr: %d",IN_SSCP,h3270.cursor_addr); 522 trace("IN_SSCP: %d cursor_addr: %d",IN_SSCP,h3270.cursor_addr);
524 523
525 if (IN_SSCP) { 524 if (IN_SSCP) {
526 - if (kybdlock & KL_OIA_MINUS) 525 + if (h3270.kybdlock & KL_OIA_MINUS)
527 return; 526 return;
528 if (aid_code != AID_ENTER && aid_code != AID_CLEAR) { 527 if (aid_code != AID_ENTER && aid_code != AID_CLEAR) {
529 - status_minus(); 528 + status_changed(&h3270,LIB3270_STATUS_MINUS);
530 kybdlock_set(KL_OIA_MINUS, "key_AID"); 529 kybdlock_set(KL_OIA_MINUS, "key_AID");
531 return; 530 return;
532 } 531 }
@@ -555,9 +554,9 @@ LIB3270_FKEY_ACTION( pfkey ) @@ -555,9 +554,9 @@ LIB3270_FKEY_ACTION( pfkey )
555 if (key < 1 || key > PF_SZ) 554 if (key < 1 || key > PF_SZ)
556 return EINVAL; 555 return EINVAL;
557 556
558 - if (kybdlock & KL_OIA_MINUS) 557 + if (hSession->kybdlock & KL_OIA_MINUS)
559 return -1; 558 return -1;
560 - else if (kybdlock) 559 + else if (hSession->kybdlock)
561 enq_key(pf_xlate[key-1]); 560 enq_key(pf_xlate[key-1]);
562 else 561 else
563 key_AID(hSession,pf_xlate[key-1]); 562 key_AID(hSession,pf_xlate[key-1]);
@@ -572,9 +571,9 @@ LIB3270_FKEY_ACTION( pakey ) @@ -572,9 +571,9 @@ LIB3270_FKEY_ACTION( pakey )
572 return EINVAL; 571 return EINVAL;
573 } 572 }
574 573
575 - if (kybdlock & KL_OIA_MINUS) 574 + if (hSession->kybdlock & KL_OIA_MINUS)
576 return -1; 575 return -1;
577 - else if (kybdlock) 576 + else if (hSession->kybdlock)
578 enq_key(pa_xlate[key-1]); 577 enq_key(pa_xlate[key-1]);
579 else 578 else
580 key_AID(hSession,pa_xlate[key-1]); 579 key_AID(hSession,pa_xlate[key-1]);
@@ -760,7 +759,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean @@ -760,7 +759,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean
760 if (skipped != NULL) 759 if (skipped != NULL)
761 *skipped = False; 760 *skipped = False;
762 761
763 - if (kybdlock) 762 + if (h3270.kybdlock)
764 { 763 {
765 char codename[64]; 764 char codename[64];
766 765
@@ -1377,10 +1376,10 @@ LIB3270_KEY_ACTION( tab ) @@ -1377,10 +1376,10 @@ LIB3270_KEY_ACTION( tab )
1377 1376
1378 // reset_idle_timer(); 1377 // reset_idle_timer();
1379 1378
1380 - if (kybdlock) { 1379 + if (hSession->kybdlock) {
1381 if (KYBDLOCK_IS_OERR) { 1380 if (KYBDLOCK_IS_OERR) {
1382 kybdlock_clr(KL_OERR_MASK, "Tab"); 1381 kybdlock_clr(KL_OERR_MASK, "Tab");
1383 - status_reset(&h3270); 1382 + status_reset(hSession);
1384 } else { 1383 } else {
1385 ENQUEUE_ACTION(lib3270_tab); 1384 ENQUEUE_ACTION(lib3270_tab);
1386 return 0; 1385 return 0;
@@ -1407,10 +1406,10 @@ LIB3270_KEY_ACTION( backtab ) @@ -1407,10 +1406,10 @@ LIB3270_KEY_ACTION( backtab )
1407 1406
1408 // reset_idle_timer(); 1407 // reset_idle_timer();
1409 1408
1410 - if (kybdlock) { 1409 + if (hSession->kybdlock) {
1411 if (KYBDLOCK_IS_OERR) { 1410 if (KYBDLOCK_IS_OERR) {
1412 kybdlock_clr(KL_OERR_MASK, "BackTab"); 1411 kybdlock_clr(KL_OERR_MASK, "BackTab");
1413 - status_reset(&h3270); 1412 + status_reset(hSession);
1414 } else { 1413 } else {
1415 ENQUEUE_ACTION(lib3270_backtab); 1414 ENQUEUE_ACTION(lib3270_backtab);
1416 return 0; 1415 return 0;
@@ -1418,26 +1417,26 @@ LIB3270_KEY_ACTION( backtab ) @@ -1418,26 +1417,26 @@ LIB3270_KEY_ACTION( backtab )
1418 } 1417 }
1419 if (!IN_3270) 1418 if (!IN_3270)
1420 return 0; 1419 return 0;
1421 - baddr = h3270.cursor_addr; 1420 + baddr = hSession->cursor_addr;
1422 DEC_BA(baddr); 1421 DEC_BA(baddr);
1423 - if (h3270.ea_buf[baddr].fa) /* at bof */ 1422 + if (hSession->ea_buf[baddr].fa) /* at bof */
1424 DEC_BA(baddr); 1423 DEC_BA(baddr);
1425 sbaddr = baddr; 1424 sbaddr = baddr;
1426 while (True) { 1425 while (True) {
1427 nbaddr = baddr; 1426 nbaddr = baddr;
1428 INC_BA(nbaddr); 1427 INC_BA(nbaddr);
1429 - if (h3270.ea_buf[baddr].fa &&  
1430 - !FA_IS_PROTECTED(h3270.ea_buf[baddr].fa) &&  
1431 - !h3270.ea_buf[nbaddr].fa) 1428 + if (hSession->ea_buf[baddr].fa &&
  1429 + !FA_IS_PROTECTED(hSession->ea_buf[baddr].fa) &&
  1430 + !hSession->ea_buf[nbaddr].fa)
1432 break; 1431 break;
1433 DEC_BA(baddr); 1432 DEC_BA(baddr);
1434 if (baddr == sbaddr) { 1433 if (baddr == sbaddr) {
1435 - cursor_move(&h3270,0); 1434 + cursor_move(hSession,0);
1436 return 0; 1435 return 0;
1437 } 1436 }
1438 } 1437 }
1439 INC_BA(baddr); 1438 INC_BA(baddr);
1440 - cursor_move(&h3270,baddr); 1439 + cursor_move(hSession,baddr);
1441 return 0; 1440 return 0;
1442 } 1441 }
1443 1442
@@ -1457,8 +1456,7 @@ static void defer_unlock(H3270 *session) @@ -1457,8 +1456,7 @@ static void defer_unlock(H3270 *session)
1457 /* 1456 /*
1458 * Reset keyboard lock. 1457 * Reset keyboard lock.
1459 */ 1458 */
1460 -void  
1461 -do_reset(Boolean explicit) 1459 +void do_reset(H3270 *session, Boolean explicit)
1462 { 1460 {
1463 /* 1461 /*
1464 * If explicit (from the keyboard) and there is typeahead or 1462 * If explicit (from the keyboard) and there is typeahead or
@@ -1467,7 +1465,7 @@ do_reset(Boolean explicit) @@ -1467,7 +1465,7 @@ do_reset(Boolean explicit)
1467 1465
1468 if (explicit 1466 if (explicit
1469 #if defined(X3270_FT) /*[*/ 1467 #if defined(X3270_FT) /*[*/
1470 - || lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE 1468 + || lib3270_get_ft_state(session) != LIB3270_FT_STATE_NONE
1471 #endif /*]*/ 1469 #endif /*]*/
1472 ) { 1470 ) {
1473 Boolean half_reset = False; 1471 Boolean half_reset = False;
@@ -1475,19 +1473,12 @@ do_reset(Boolean explicit) @@ -1475,19 +1473,12 @@ do_reset(Boolean explicit)
1475 if (flush_ta()) 1473 if (flush_ta())
1476 half_reset = True; 1474 half_reset = True;
1477 1475
1478 -/*  
1479 - if (composing != NONE) {  
1480 - composing = NONE;  
1481 - status_compose(False, 0, KT_STD);  
1482 - half_reset = True;  
1483 - }  
1484 -*/  
1485 if (half_reset) 1476 if (half_reset)
1486 return; 1477 return;
1487 } 1478 }
1488 1479
1489 /* Always clear insert mode. */ 1480 /* Always clear insert mode. */
1490 - lib3270_set_toggle(&h3270,LIB3270_TOGGLE_INSERT,0); 1481 + lib3270_set_toggle(session,LIB3270_TOGGLE_INSERT,0);
1491 1482
1492 /* Otherwise, if not connect, reset is a no-op. */ 1483 /* Otherwise, if not connect, reset is a no-op. */
1493 if (!CONNECTED) 1484 if (!CONNECTED)
@@ -1497,7 +1488,7 @@ do_reset(Boolean explicit) @@ -1497,7 +1488,7 @@ do_reset(Boolean explicit)
1497 * Remove any deferred keyboard unlock. We will either unlock the 1488 * Remove any deferred keyboard unlock. We will either unlock the
1498 * keyboard now, or want to defer further into the future. 1489 * keyboard now, or want to defer further into the future.
1499 */ 1490 */
1500 - if (kybdlock & KL_DEFERRED_UNLOCK) 1491 + if (session->kybdlock & KL_DEFERRED_UNLOCK)
1501 RemoveTimeOut(unlock_id); 1492 RemoveTimeOut(unlock_id);
1502 1493
1503 /* 1494 /*
@@ -1506,29 +1497,28 @@ do_reset(Boolean explicit) @@ -1506,29 +1497,28 @@ do_reset(Boolean explicit)
1506 */ 1497 */
1507 if (explicit 1498 if (explicit
1508 #if defined(X3270_FT) /*[*/ 1499 #if defined(X3270_FT) /*[*/
1509 - || lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE 1500 + || lib3270_get_ft_state(session) != LIB3270_FT_STATE_NONE
1510 #endif /*]*/ 1501 #endif /*]*/
1511 - || (!h3270.unlock_delay) // && !sms_in_macro()) 1502 + || (!session->unlock_delay) // && !sms_in_macro())
1512 || (unlock_delay_time != 0 && (time(NULL) - unlock_delay_time) > 1)) { 1503 || (unlock_delay_time != 0 && (time(NULL) - unlock_delay_time) > 1)) {
1513 kybdlock_clr(-1, "do_reset"); 1504 kybdlock_clr(-1, "do_reset");
1514 - } else if (kybdlock & 1505 + } else if (session->kybdlock &
1515 (KL_DEFERRED_UNLOCK | KL_OIA_TWAIT | KL_OIA_LOCKED | KL_AWAITING_FIRST)) { 1506 (KL_DEFERRED_UNLOCK | KL_OIA_TWAIT | KL_OIA_LOCKED | KL_AWAITING_FIRST)) {
1516 kybdlock_clr(~KL_DEFERRED_UNLOCK, "do_reset"); 1507 kybdlock_clr(~KL_DEFERRED_UNLOCK, "do_reset");
1517 kybdlock_set(KL_DEFERRED_UNLOCK, "do_reset"); 1508 kybdlock_set(KL_DEFERRED_UNLOCK, "do_reset");
1518 - unlock_id = AddTimeOut(UNLOCK_MS, &h3270, defer_unlock); 1509 + unlock_id = AddTimeOut(UNLOCK_MS, session, defer_unlock);
1519 } 1510 }
1520 1511
1521 /* Clean up other modes. */ 1512 /* Clean up other modes. */
1522 - status_reset(&h3270);  
1523 - mcursor_normal(&h3270); 1513 + status_reset(session);
  1514 + mcursor_normal(session);
1524 1515
1525 } 1516 }
1526 1517
1527 -LIB3270_CLEAR_SELECTION_ACTION( reset ) 1518 +LIB3270_ACTION( reset )
1528 { 1519 {
1529 -// reset_idle_timer();  
1530 -  
1531 - do_reset(True); 1520 + lib3270_unselect(hSession);
  1521 + do_reset(hSession,True);
1532 return 0; 1522 return 0;
1533 } 1523 }
1534 1524
@@ -1539,7 +1529,8 @@ LIB3270_CLEAR_SELECTION_ACTION( reset ) @@ -1539,7 +1529,8 @@ LIB3270_CLEAR_SELECTION_ACTION( reset )
1539 LIB3270_ACTION( firstfield ) 1529 LIB3270_ACTION( firstfield )
1540 { 1530 {
1541 // reset_idle_timer(); 1531 // reset_idle_timer();
1542 - if (kybdlock) { 1532 + if (hSession->kybdlock)
  1533 + {
1543 ENQUEUE_ACTION(lib3270_firstfield); 1534 ENQUEUE_ACTION(lib3270_firstfield);
1544 return 0; 1535 return 0;
1545 } 1536 }
@@ -1585,7 +1576,7 @@ void Left_action(Widget w unused, XEvent *event, String *params, Cardinal *num_p @@ -1585,7 +1576,7 @@ void Left_action(Widget w unused, XEvent *event, String *params, Cardinal *num_p
1585 1576
1586 LIB3270_CURSOR_ACTION( left ) 1577 LIB3270_CURSOR_ACTION( left )
1587 { 1578 {
1588 - if (kybdlock) 1579 + if (hSession->kybdlock)
1589 { 1580 {
1590 if (KYBDLOCK_IS_OERR) 1581 if (KYBDLOCK_IS_OERR)
1591 { 1582 {
@@ -1705,7 +1696,7 @@ do_delete(void) @@ -1705,7 +1696,7 @@ do_delete(void)
1705 1696
1706 LIB3270_ACTION( delete ) 1697 LIB3270_ACTION( delete )
1707 { 1698 {
1708 - if (kybdlock) 1699 + if (hSession->kybdlock)
1709 { 1700 {
1710 ENQUEUE_ACTION(lib3270_delete); 1701 ENQUEUE_ACTION(lib3270_delete);
1711 return 0; 1702 return 0;
@@ -1735,7 +1726,7 @@ LIB3270_ACTION( delete ) @@ -1735,7 +1726,7 @@ LIB3270_ACTION( delete )
1735 */ 1726 */
1736 LIB3270_ACTION( backspace ) 1727 LIB3270_ACTION( backspace )
1737 { 1728 {
1738 - if (kybdlock) 1729 + if (hSession->kybdlock)
1739 { 1730 {
1740 ENQUEUE_ACTION( lib3270_backspace ); 1731 ENQUEUE_ACTION( lib3270_backspace );
1741 return 0; 1732 return 0;
@@ -1825,7 +1816,7 @@ do_erase(void) @@ -1825,7 +1816,7 @@ do_erase(void)
1825 LIB3270_ACTION( erase ) 1816 LIB3270_ACTION( erase )
1826 { 1817 {
1827 // reset_idle_timer(); 1818 // reset_idle_timer();
1828 - if (kybdlock) { 1819 + if (hSession->kybdlock) {
1829 ENQUEUE_ACTION(lib3270_erase); 1820 ENQUEUE_ACTION(lib3270_erase);
1830 return 0; 1821 return 0;
1831 } 1822 }
@@ -1847,7 +1838,7 @@ LIB3270_CURSOR_ACTION( right ) @@ -1847,7 +1838,7 @@ LIB3270_CURSOR_ACTION( right )
1847 register int baddr; 1838 register int baddr;
1848 enum dbcs_state d; 1839 enum dbcs_state d;
1849 1840
1850 - if (kybdlock) 1841 + if (hSession->kybdlock)
1851 { 1842 {
1852 if (KYBDLOCK_IS_OERR) 1843 if (KYBDLOCK_IS_OERR)
1853 { 1844 {
@@ -1931,7 +1922,7 @@ LIB3270_ACTION( previousword ) @@ -1931,7 +1922,7 @@ LIB3270_ACTION( previousword )
1931 Boolean prot; 1922 Boolean prot;
1932 1923
1933 // reset_idle_timer(); 1924 // reset_idle_timer();
1934 - if (kybdlock) { 1925 + if (hSession->kybdlock) {
1935 ENQUEUE_ACTION(lib3270_previousword); 1926 ENQUEUE_ACTION(lib3270_previousword);
1936 // enq_ta(PreviousWord_action, CN, CN); 1927 // enq_ta(PreviousWord_action, CN, CN);
1937 return 0; 1928 return 0;
@@ -2082,7 +2073,7 @@ LIB3270_ACTION( nextword ) @@ -2082,7 +2073,7 @@ LIB3270_ACTION( nextword )
2082 unsigned char c; 2073 unsigned char c;
2083 2074
2084 // reset_idle_timer(); 2075 // reset_idle_timer();
2085 - if (kybdlock) { 2076 + if (hSession->kybdlock) {
2086 ENQUEUE_ACTION( lib3270_nextword ); 2077 ENQUEUE_ACTION( lib3270_nextword );
2087 // enq_ta(NextWord_action, CN, CN); 2078 // enq_ta(NextWord_action, CN, CN);
2088 return 0; 2079 return 0;
@@ -2151,7 +2142,7 @@ LIB3270_CURSOR_ACTION( up ) @@ -2151,7 +2142,7 @@ LIB3270_CURSOR_ACTION( up )
2151 register int baddr; 2142 register int baddr;
2152 2143
2153 // reset_idle_timer(); 2144 // reset_idle_timer();
2154 - if (kybdlock) { 2145 + if (hSession->kybdlock) {
2155 if (KYBDLOCK_IS_OERR) 2146 if (KYBDLOCK_IS_OERR)
2156 { 2147 {
2157 kybdlock_clr(KL_OERR_MASK, "Up"); 2148 kybdlock_clr(KL_OERR_MASK, "Up");
@@ -2188,7 +2179,7 @@ LIB3270_CURSOR_ACTION( down ) @@ -2188,7 +2179,7 @@ LIB3270_CURSOR_ACTION( down )
2188 register int baddr; 2179 register int baddr;
2189 2180
2190 // reset_idle_timer(); 2181 // reset_idle_timer();
2191 - if (kybdlock) 2182 + if (hSession->kybdlock)
2192 { 2183 {
2193 if (KYBDLOCK_IS_OERR) 2184 if (KYBDLOCK_IS_OERR)
2194 { 2185 {
@@ -2222,11 +2213,9 @@ LIB3270_CURSOR_ACTION( newline ) @@ -2222,11 +2213,9 @@ LIB3270_CURSOR_ACTION( newline )
2222 register int baddr, faddr; 2213 register int baddr, faddr;
2223 register unsigned char fa; 2214 register unsigned char fa;
2224 2215
2225 -// reset_idle_timer();  
2226 - if (kybdlock) 2216 + if (hSession->kybdlock)
2227 { 2217 {
2228 ENQUEUE_ACTION(lib3270_cursor_newline); 2218 ENQUEUE_ACTION(lib3270_cursor_newline);
2229 -// enq_ta(Newline_action, CN, CN);  
2230 return 0; 2219 return 0;
2231 } 2220 }
2232 #if defined(X3270_ANSI) /*[*/ 2221 #if defined(X3270_ANSI) /*[*/
@@ -2254,7 +2243,7 @@ LIB3270_CURSOR_ACTION( newline ) @@ -2254,7 +2243,7 @@ LIB3270_CURSOR_ACTION( newline )
2254 */ 2243 */
2255 LIB3270_ACTION( dup ) 2244 LIB3270_ACTION( dup )
2256 { 2245 {
2257 - if (kybdlock) 2246 + if (hSession->kybdlock)
2258 { 2247 {
2259 ENQUEUE_ACTION(lib3270_dup); 2248 ENQUEUE_ACTION(lib3270_dup);
2260 return 0; 2249 return 0;
@@ -2277,7 +2266,7 @@ LIB3270_ACTION( dup ) @@ -2277,7 +2266,7 @@ LIB3270_ACTION( dup )
2277 */ 2266 */
2278 LIB3270_ACTION( fieldmark ) 2267 LIB3270_ACTION( fieldmark )
2279 { 2268 {
2280 - if (kybdlock) 2269 + if (hSession->kybdlock)
2281 { 2270 {
2282 ENQUEUE_ACTION(lib3270_fieldmark); 2271 ENQUEUE_ACTION(lib3270_fieldmark);
2283 return 0; 2272 return 0;
@@ -2301,13 +2290,11 @@ LIB3270_ACTION( fieldmark ) @@ -2301,13 +2290,11 @@ LIB3270_ACTION( fieldmark )
2301 */ 2290 */
2302 LIB3270_KEY_ACTION( enter ) 2291 LIB3270_KEY_ACTION( enter )
2303 { 2292 {
2304 -// reset_idle_timer();  
2305 -  
2306 - trace("%s (kybdlock & KL_OIA_MINUS): %d kybdlock: %d",__FUNCTION__,(kybdlock & KL_OIA_MINUS),kybdlock); 2293 + trace("%s (kybdlock & KL_OIA_MINUS): %d kybdlock: %d",__FUNCTION__,(hSession->kybdlock & KL_OIA_MINUS),hSession->kybdlock);
2307 2294
2308 - if (kybdlock & KL_OIA_MINUS) 2295 + if (hSession->kybdlock & KL_OIA_MINUS)
2309 return -1; 2296 return -1;
2310 - else if (kybdlock) 2297 + else if (hSession->kybdlock)
2311 ENQUEUE_ACTION(lib3270_enter); 2298 ENQUEUE_ACTION(lib3270_enter);
2312 else 2299 else
2313 key_AID(hSession,AID_ENTER); 2300 key_AID(hSession,AID_ENTER);
@@ -2326,9 +2313,9 @@ LIB3270_ACTION( sysreq ) @@ -2326,9 +2313,9 @@ LIB3270_ACTION( sysreq )
2326 } else 2313 } else
2327 #endif /*]*/ 2314 #endif /*]*/
2328 { 2315 {
2329 - if (kybdlock & KL_OIA_MINUS) 2316 + if (hSession->kybdlock & KL_OIA_MINUS)
2330 return 0; 2317 return 0;
2331 - else if (kybdlock) 2318 + else if (hSession->kybdlock)
2332 ENQUEUE_ACTION(lib3270_sysreq); 2319 ENQUEUE_ACTION(lib3270_sysreq);
2333 else 2320 else
2334 key_AID(hSession,AID_SYSREQ); 2321 key_AID(hSession,AID_SYSREQ);
@@ -2343,9 +2330,9 @@ LIB3270_ACTION( sysreq ) @@ -2343,9 +2330,9 @@ LIB3270_ACTION( sysreq )
2343 LIB3270_ACTION( clear ) 2330 LIB3270_ACTION( clear )
2344 { 2331 {
2345 // reset_idle_timer(); 2332 // reset_idle_timer();
2346 - if (kybdlock & KL_OIA_MINUS) 2333 + if (hSession->kybdlock & KL_OIA_MINUS)
2347 return 0; 2334 return 0;
2348 - if (kybdlock && CONNECTED) { 2335 + if (hSession->kybdlock && CONNECTED) {
2349 ENQUEUE_ACTION(lib3270_clear); 2336 ENQUEUE_ACTION(lib3270_clear);
2350 return 0; 2337 return 0;
2351 } 2338 }
@@ -2485,7 +2472,7 @@ LIB3270_ACTION( eraseeol ) @@ -2485,7 +2472,7 @@ LIB3270_ACTION( eraseeol )
2485 enum dbcs_why why = DBCS_FIELD; 2472 enum dbcs_why why = DBCS_FIELD;
2486 2473
2487 // reset_idle_timer(); 2474 // reset_idle_timer();
2488 - if (kybdlock) 2475 + if (hSession->kybdlock)
2489 { 2476 {
2490 ENQUEUE_ACTION(lib3270_eraseeol); 2477 ENQUEUE_ACTION(lib3270_eraseeol);
2491 return 0; 2478 return 0;
@@ -2551,7 +2538,7 @@ LIB3270_ACTION( eraseeof ) @@ -2551,7 +2538,7 @@ LIB3270_ACTION( eraseeof )
2551 enum dbcs_why why = DBCS_FIELD; 2538 enum dbcs_why why = DBCS_FIELD;
2552 2539
2553 // reset_idle_timer(); 2540 // reset_idle_timer();
2554 - if (kybdlock) 2541 + if (hSession->kybdlock)
2555 { 2542 {
2556 ENQUEUE_ACTION(lib3270_eraseeof); 2543 ENQUEUE_ACTION(lib3270_eraseeof);
2557 return 0; 2544 return 0;
@@ -2601,7 +2588,7 @@ LIB3270_ACTION( eraseinput ) @@ -2601,7 +2588,7 @@ LIB3270_ACTION( eraseinput )
2601 Boolean f; 2588 Boolean f;
2602 2589
2603 // reset_idle_timer(); 2590 // reset_idle_timer();
2604 - if (kybdlock) { 2591 + if (hSession->kybdlock) {
2605 ENQUEUE_ACTION( lib3270_eraseinput ); 2592 ENQUEUE_ACTION( lib3270_eraseinput );
2606 return 0; 2593 return 0;
2607 } 2594 }
@@ -2664,7 +2651,7 @@ LIB3270_ACTION( deleteword ) @@ -2664,7 +2651,7 @@ LIB3270_ACTION( deleteword )
2664 register unsigned char fa; 2651 register unsigned char fa;
2665 2652
2666 // reset_idle_timer(); 2653 // reset_idle_timer();
2667 - if (kybdlock) { 2654 + if (hSession->kybdlock) {
2668 ENQUEUE_ACTION(lib3270_deleteword); 2655 ENQUEUE_ACTION(lib3270_deleteword);
2669 // enq_ta(DeleteWord_action, CN, CN); 2656 // enq_ta(DeleteWord_action, CN, CN);
2670 return 0; 2657 return 0;
@@ -2731,7 +2718,7 @@ LIB3270_ACTION( deletefield ) @@ -2731,7 +2718,7 @@ LIB3270_ACTION( deletefield )
2731 register unsigned char fa; 2718 register unsigned char fa;
2732 2719
2733 // reset_idle_timer(); 2720 // reset_idle_timer();
2734 - if (kybdlock) { 2721 + if (hSession->kybdlock) {
2735 ENQUEUE_ACTION(lib3270_deletefield); 2722 ENQUEUE_ACTION(lib3270_deletefield);
2736 // enq_ta(DeleteField_action, CN, CN); 2723 // enq_ta(DeleteField_action, CN, CN);
2737 return 0; 2724 return 0;
@@ -2836,8 +2823,8 @@ LIB3270_ACTION( fieldend ) @@ -2836,8 +2823,8 @@ LIB3270_ACTION( fieldend )
2836 unsigned char fa, c; 2823 unsigned char fa, c;
2837 int last_nonblank = -1; 2824 int last_nonblank = -1;
2838 2825
2839 -// reset_idle_timer();  
2840 - if (kybdlock) { 2826 + if (hSession->kybdlock)
  2827 + {
2841 ENQUEUE_ACTION( lib3270_fieldend ); 2828 ENQUEUE_ACTION( lib3270_fieldend );
2842 return 0; 2829 return 0;
2843 } 2830 }
@@ -3003,7 +2990,8 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p @@ -3003,7 +2990,8 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p
3003 * It isn't possible to unlock the keyboard from a string, 2990 * It isn't possible to unlock the keyboard from a string,
3004 * so if the keyboard is locked, it's fatal 2991 * so if the keyboard is locked, it's fatal
3005 */ 2992 */
3006 - if (kybdlock) { 2993 + if (session->kybdlock)
  2994 + {
3007 trace_event(" keyboard locked, string dropped\n"); 2995 trace_event(" keyboard locked, string dropped\n");
3008 return 0; 2996 return 0;
3009 } 2997 }
@@ -3350,7 +3338,7 @@ kybd_prime(void) @@ -3350,7 +3338,7 @@ kybd_prime(void)
3350 * No point in trying if the screen isn't formatted, the keyboard 3338 * No point in trying if the screen isn't formatted, the keyboard
3351 * is locked, or we aren't in 3270 mode. 3339 * is locked, or we aren't in 3270 mode.
3352 */ 3340 */
3353 - if (!h3270.formatted || kybdlock || !IN_3270) 3341 + if (!h3270.formatted || h3270.kybdlock || !IN_3270)
3354 return 0; 3342 return 0;
3355 3343
3356 fa = get_field_attribute(&h3270,h3270.cursor_addr); 3344 fa = get_field_attribute(&h3270,h3270.cursor_addr);
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 #define KYBDC_H_INCLUDED 22 #define KYBDC_H_INCLUDED
23 23
24 /* keyboard lock states */ 24 /* keyboard lock states */
25 -LIB3270_INTERNAL unsigned int kybdlock; 25 +// LIB3270_INTERNAL unsigned int kybdlock;
26 #define KL_OERR_MASK 0x000f 26 #define KL_OERR_MASK 0x000f
27 #define KL_OERR_PROTECTED 1 27 #define KL_OERR_PROTECTED 1
28 #define KL_OERR_NUMERIC 2 28 #define KL_OERR_NUMERIC 2
@@ -37,114 +37,11 @@ LIB3270_INTERNAL unsigned int kybdlock; @@ -37,114 +37,11 @@ LIB3270_INTERNAL unsigned int kybdlock;
37 #define KL_SCROLLED 0x0400 37 #define KL_SCROLLED 0x0400
38 #define KL_OIA_MINUS 0x0800 38 #define KL_OIA_MINUS 0x0800
39 39
40 -// void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause, Boolean *skipped);  
41 -  
42 -/* actions */ /*  
43 -extern void AltCursor_action(Widget w, XEvent *event, String *params,  
44 - Cardinal *num_params);  
45 -extern void Attn_action(Widget w, XEvent *event, String *params,  
46 - Cardinal *num_params);  
47 -extern void BackSpace_action(Widget w, XEvent *event, String *params,  
48 - Cardinal *num_params);  
49 -extern void BackTab_action(Widget w, XEvent *event, String *params,  
50 - Cardinal *num_params);  
51 -extern void CircumNot_action(Widget w, XEvent *event, String *params,  
52 - Cardinal *num_params); */  
53 -/*  
54 -extern void Clear_action(Widget w, XEvent *event, String *params,  
55 - Cardinal *num_params);  
56 -*/ /*  
57 -extern void Compose_action(Widget w, XEvent *event, String *params,  
58 - Cardinal *num_params);  
59 -extern void CursorSelect_action(Widget w, XEvent *event, String *params,  
60 - Cardinal *num_params);  
61 -extern void Default_action(Widget w, XEvent *event, String *params,  
62 - Cardinal *num_params);  
63 -extern void DeleteField_action(Widget w, XEvent *event, String *params,  
64 - Cardinal *num_params);  
65 -extern void DeleteWord_action(Widget w, XEvent *event, String *params,  
66 - Cardinal *num_params);  
67 -extern void Delete_action(Widget w, XEvent *event, String *params,  
68 - Cardinal *num_params);  
69 -extern void Down_action(Widget w, XEvent *event, String *params,  
70 - Cardinal *num_params);  
71 -extern void Dup_action(Widget w, XEvent *event, String *params,  
72 - Cardinal *num_params);  
73 -extern void Enter_action(Widget w, XEvent *event, String *params,  
74 - Cardinal *num_params);  
75 -extern void EraseEOF_action(Widget w, XEvent *event, String *params,  
76 - Cardinal *num_params);  
77 -extern void EraseInput_action(Widget w, XEvent *event, String *params,  
78 - Cardinal *num_params);  
79 -extern void Erase_action(Widget w, XEvent *event, String *params,  
80 - Cardinal *num_params);  
81 -extern void FieldEnd_action(Widget w, XEvent *event, String *params,  
82 - Cardinal *num_params);  
83 -extern void FieldMark_action(Widget w, XEvent *event, String *params,  
84 - Cardinal *num_params);  
85 -extern void Flip_action(Widget w, XEvent *event, String *params,  
86 - Cardinal *num_params);  
87 -extern void HexString_action(Widget w, XEvent *event, String *params,  
88 - Cardinal *num_params);  
89 -extern void Home_action(Widget w, XEvent *event, String *params,  
90 - Cardinal *num_params);  
91 -extern void ignore_action(Widget w, XEvent *event, String *params,  
92 - Cardinal *num_params);  
93 -extern void Insert_action(Widget w, XEvent *event, String *params,  
94 - Cardinal *num_params);  
95 -extern void Interrupt_action(Widget w, XEvent *event, String *params,  
96 - Cardinal *num_params);  
97 -extern void Key_action(Widget w, XEvent *event, String *params,  
98 - Cardinal *num_params);  
99 -extern void Left2_action(Widget w, XEvent *event, String *params,  
100 - Cardinal *num_params);  
101 -extern void Left_action(Widget w, XEvent *event, String *params,  
102 - Cardinal *num_params);  
103 -extern void MonoCase_action(Widget w, XEvent *event, String *params,  
104 - Cardinal *num_params);  
105 -extern void MouseSelect_action(Widget w, XEvent *event, String *params,  
106 - Cardinal *num_params);  
107 -extern void MoveCursor_action(Widget w, XEvent *event, String *params,  
108 - Cardinal *num_params);  
109 -extern void Newline_action(Widget w, XEvent *event, String *params,  
110 - Cardinal *num_params);  
111 -extern void NextWord_action(Widget w, XEvent *event, String *params,  
112 - Cardinal *num_params);  
113 -extern void PA_action(Widget w, XEvent *event, String *params,  
114 - Cardinal *num_params);  
115 -extern void PA_Shift_action(Widget w, XEvent *event, String *params,  
116 - Cardinal *num_params);  
117 -  
118 -//extern void PF_action(Widget w, XEvent *event, String *params, Cardinal *num_params);  
119 -  
120 -extern void PreviousWord_action(Widget w, XEvent *event, String *params,  
121 - Cardinal *num_params);  
122 -extern void Reset_action(Widget w, XEvent *event, String *params,  
123 - Cardinal *num_params);  
124 -extern void Right2_action(Widget w, XEvent *event, String *params,  
125 - Cardinal *num_params);  
126 -extern void Right_action(Widget w, XEvent *event, String *params,  
127 - Cardinal *num_params);  
128 -extern void String_action(Widget w, XEvent *event, String *params,  
129 - Cardinal *num_params);  
130 -extern void SysReq_action(Widget w, XEvent *event, String *params,  
131 - Cardinal *num_params);  
132 -extern void Tab_action(Widget w, XEvent *event, String *params,  
133 - Cardinal *num_params);  
134 -extern void TemporaryKeymap_action(Widget w, XEvent *event, String *params,  
135 - Cardinal *num_params);  
136 -extern void ToggleInsert_action(Widget w, XEvent *event, String *params,  
137 - Cardinal *num_params);  
138 -extern void ToggleReverse_action(Widget w, XEvent *event, String *params,  
139 - Cardinal *num_params);  
140 -extern void Up_action(Widget w, XEvent *event, String *params, Cardinal *num_params);  
141 -  
142 -*/  
143 40
144 /* other functions */ 41 /* other functions */
145 LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc); 42 LIB3270_INTERNAL void add_xk(KeySym key, KeySym assoc);
146 LIB3270_INTERNAL void clear_xks(void); 43 LIB3270_INTERNAL void clear_xks(void);
147 -LIB3270_INTERNAL void do_reset(Boolean explicit); 44 +LIB3270_INTERNAL void do_reset(H3270 *session, Boolean explicit);
148 LIB3270_INTERNAL void hex_input(char *s); 45 LIB3270_INTERNAL void hex_input(char *s);
149 LIB3270_INTERNAL void kybdlock_clr(unsigned int bits, const char *cause); 46 LIB3270_INTERNAL void kybdlock_clr(unsigned int bits, const char *cause);
150 LIB3270_INTERNAL void kybd_inhibit(Boolean inhibit); 47 LIB3270_INTERNAL void kybd_inhibit(Boolean inhibit);
@@ -342,7 +342,6 @@ @@ -342,7 +342,6 @@
342 action[] = 342 action[] =
343 { 343 {
344 #define DECLARE_LIB3270_ACTION( name ) { #name, lib3270_ ## name }, 344 #define DECLARE_LIB3270_ACTION( name ) { #name, lib3270_ ## name },
345 - #define DECLARE_LIB3270_CLEAR_SELECTION_ACTION( name ) { #name, lib3270_ ## name },  
346 #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name }, 345 #define DECLARE_LIB3270_KEY_ACTION( name ) { #name, lib3270_ ## name },
347 #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name }, 346 #define DECLARE_LIB3270_CURSOR_ACTION( name ) { #name, lib3270_cursor_ ## name },
348 #define DECLARE_LIB3270_FKEY_ACTION( name ) /* */ 347 #define DECLARE_LIB3270_FKEY_ACTION( name ) /* */
@@ -186,12 +186,12 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) @@ -186,12 +186,12 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str)
186 data.orig_addr = h->cursor_addr; 186 data.orig_addr = h->cursor_addr;
187 data.orig_col = BA_TO_COL(h->cursor_addr); 187 data.orig_col = BA_TO_COL(h->cursor_addr);
188 188
189 - if(kybdlock) 189 + if(h->kybdlock)
190 return -EINVAL; 190 return -EINVAL;
191 191
192 h->suspend(h); 192 h->suspend(h);
193 193
194 - while(*str && last && !kybdlock && h->cursor_addr >= data.orig_addr) 194 + while(*str && last && !h->kybdlock && h->cursor_addr >= data.orig_addr)
195 { 195 {
196 switch(*str) 196 switch(*str)
197 { 197 {
@@ -454,11 +454,11 @@ void status_reset(H3270 *session) @@ -454,11 +454,11 @@ void status_reset(H3270 *session)
454 { 454 {
455 CHECK_SESSION_HANDLE(session); 455 CHECK_SESSION_HANDLE(session);
456 456
457 - if (kybdlock & KL_ENTER_INHIBIT) 457 + if (session->kybdlock & KL_ENTER_INHIBIT)
458 { 458 {
459 status_changed(session,LIB3270_STATUS_INHIBIT); 459 status_changed(session,LIB3270_STATUS_INHIBIT);
460 } 460 }
461 - else if (kybdlock & KL_DEFERRED_UNLOCK) 461 + else if (session->kybdlock & KL_DEFERRED_UNLOCK)
462 { 462 {
463 status_changed(session,LIB3270_STATUS_X); 463 status_changed(session,LIB3270_STATUS_X);
464 } 464 }
@@ -540,7 +540,7 @@ static void status_connect(H3270 *session, int connected, void *dunno) @@ -540,7 +540,7 @@ static void status_connect(H3270 *session, int connected, void *dunno)
540 { 540 {
541 set_status(session,OIA_FLAG_BOXSOLID,IN_3270 && !IN_SSCP); 541 set_status(session,OIA_FLAG_BOXSOLID,IN_3270 && !IN_SSCP);
542 542
543 - if (kybdlock & KL_AWAITING_FIRST) 543 + if (session->kybdlock & KL_AWAITING_FIRST)
544 id = LIB3270_STATUS_AWAITING_FIRST; 544 id = LIB3270_STATUS_AWAITING_FIRST;
545 else 545 else
546 id = LIB3270_STATUS_CONNECTED; 546 id = LIB3270_STATUS_CONNECTED;
@@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
43 #include "screenc.h" 43 #include "screenc.h"
44 #include "ctlrc.h" 44 #include "ctlrc.h"
45 #include "ftc.h" 45 #include "ftc.h"
  46 +#include "kybdc.h"
46 47
47 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ 48 /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
48 49
@@ -193,6 +194,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) @@ -193,6 +194,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model)
193 hSession->model_num = -1; 194 hSession->model_num = -1;
194 hSession->cstate = LIB3270_NOT_CONNECTED; 195 hSession->cstate = LIB3270_NOT_CONNECTED;
195 hSession->oia_status = -1; 196 hSession->oia_status = -1;
  197 + hSession->kybdlock = KL_NOT_CONNECTED;
196 198
197 #ifdef _WIN32 199 #ifdef _WIN32
198 hSession->sockEvent = NULL; 200 hSession->sockEvent = NULL;
@@ -35,7 +35,7 @@ LIB3270_INTERNAL void set_status(H3270 *session, OIA_FLAG id, Boolean on); @@ -35,7 +35,7 @@ LIB3270_INTERNAL void set_status(H3270 *session, OIA_FLAG id, Boolean on);
35 35
36 36
37 #define status_typeahead(h,on) set_status(h,OIA_FLAG_TYPEAHEAD,on) 37 #define status_typeahead(h,on) set_status(h,OIA_FLAG_TYPEAHEAD,on)
38 -#define status_kybdlock() status_changed(NULL,LIB3270_STATUS_KYBDLOCK)  
39 -#define status_syswait() status_changed(NULL,LIB3270_STATUS_SYSWAIT)  
40 -#define status_minus() status_changed(NULL,LIB3270_STATUS_MINUS) 38 +// #define status_kybdlock(h) status_changed(h,LIB3270_STATUS_KYBDLOCK)
  39 +// #define status_syswait(h) status_changed(h,LIB3270_STATUS_SYSWAIT)
  40 +// #define status_minus() status_changed(NULL,LIB3270_STATUS_MINUS)
41 41
@@ -2131,7 +2131,7 @@ static void @@ -2131,7 +2131,7 @@ static void
2131 net_cookout(const char *buf, int len) 2131 net_cookout(const char *buf, int len)
2132 { 2132 {
2133 2133
2134 - if (!IN_ANSI || (kybdlock & KL_AWAITING_FIRST)) 2134 + if (!IN_ANSI || (h3270.kybdlock & KL_AWAITING_FIRST))
2135 return; 2135 return;
2136 2136
2137 if (linemode) { 2137 if (linemode) {