Commit 9c2d68bb36b1a2c3779407c00e5d89ce0fa58cf5
1 parent
890f32dd
Exists in
master
and in
3 other branches
Melhorando teste de "TerminalReady"
Showing
5 changed files
with
46 additions
and
14 deletions
Show diff stats
ctlr.c
| ... | ... | @@ -2205,21 +2205,20 @@ int ctlr_any_data(H3270 *session) |
| 2205 | 2205 | * Clear the text (non-status) portion of the display. Also resets the cursor |
| 2206 | 2206 | * and buffer addresses and extended attributes. |
| 2207 | 2207 | */ |
| 2208 | -void | |
| 2209 | -ctlr_clear(H3270 *session, Boolean can_snap) | |
| 2208 | +void ctlr_clear(H3270 *session, Boolean can_snap) | |
| 2210 | 2209 | { |
| 2211 | 2210 | /* Snap any data that is about to be lost into the trace file. */ |
| 2211 | +#if defined(X3270_TRACE) | |
| 2212 | + | |
| 2212 | 2213 | if (ctlr_any_data(session)) |
| 2213 | 2214 | { |
| 2214 | -#if defined(X3270_TRACE) /*[*/ | |
| 2215 | 2215 | if (can_snap && !session->trace_skipping && lib3270_get_toggle(session,LIB3270_TOGGLE_SCREEN_TRACE)) |
| 2216 | 2216 | trace_screen(session); |
| 2217 | -#endif /*]*/ | |
| 2218 | -// scroll_save(session->maxROWS, ever_3270 ? False : True); | |
| 2219 | 2217 | } |
| 2220 | -#if defined(X3270_TRACE) /*[*/ | |
| 2218 | + | |
| 2221 | 2219 | session->trace_skipping = 0; |
| 2222 | -#endif /*]*/ | |
| 2220 | + | |
| 2221 | +#endif | |
| 2223 | 2222 | |
| 2224 | 2223 | /* Clear the screen. */ |
| 2225 | 2224 | (void) memset((char *)session->ea_buf, 0, session->rows*session->cols*sizeof(struct lib3270_ea)); | ... | ... |
iocalls.c
| ... | ... | @@ -726,14 +726,14 @@ LIB3270_EXPORT int lib3270_wait_for_ready(H3270 *hSession, int seconds) |
| 726 | 726 | { |
| 727 | 727 | time_t end = time(0)+seconds; |
| 728 | 728 | |
| 729 | - if(hSession->oia_status == LIB3270_STATUS_BLANK) | |
| 729 | + if(!lib3270_lock_status(hSession)) | |
| 730 | 730 | return 0; |
| 731 | 731 | |
| 732 | 732 | while(time(0) < end) |
| 733 | 733 | { |
| 734 | 734 | event_dispatcher(hSession,1); |
| 735 | 735 | |
| 736 | - if(hSession->oia_status == LIB3270_STATUS_BLANK) | |
| 736 | + if(!lib3270_lock_status(hSession)) | |
| 737 | 737 | return 0; |
| 738 | 738 | |
| 739 | 739 | if(!lib3270_connected(hSession)) | ... | ... |
kybd.c
| ... | ... | @@ -384,7 +384,7 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits) |
| 384 | 384 | hSession->unlock_delay_time = time(NULL); |
| 385 | 385 | } |
| 386 | 386 | hSession->kybdlock = n; |
| 387 | - status_changed(hSession,LIB3270_STATUS_KYBDLOCK); | |
| 387 | + status_changed(hSession,LIB3270_MESSAGE_KYBDLOCK); | |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| ... | ... | @@ -409,7 +409,7 @@ void lib3270_kybdlock_clear(H3270 *hSession, LIB3270_KL_STATE bits) |
| 409 | 409 | hSession->unlock_delay_time = 0; |
| 410 | 410 | } |
| 411 | 411 | hSession->kybdlock = n; |
| 412 | - status_changed(hSession,LIB3270_STATUS_KYBDLOCK); | |
| 412 | + status_changed(hSession,LIB3270_MESSAGE_KYBDLOCK); | |
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | ... | ... |
screen.c
| ... | ... | @@ -528,6 +528,42 @@ LIB3270_EXPORT LIB3270_STATUS lib3270_get_program_message(H3270 *session) |
| 528 | 528 | return session->oia_status; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | +/** | |
| 532 | + * Check if the terminal is ready for commands. | |
| 533 | + * | |
| 534 | + * @param h Session handle. | |
| 535 | + * | |
| 536 | + * @return 0 if the terminal is ready (no message, keyboard unlocked), LIB3270_MESSAGE if not | |
| 537 | + * | |
| 538 | + */ | |
| 539 | +LIB3270_EXPORT int lib3270_lock_status(H3270 *hSession) | |
| 540 | +{ | |
| 541 | + CHECK_SESSION_HANDLE(hSession); | |
| 542 | + | |
| 543 | + if(hSession->oia_status) | |
| 544 | + return hSession->oia_status; | |
| 545 | + | |
| 546 | + if(hSession->kybdlock) | |
| 547 | + return LIB3270_MESSAGE_KYBDLOCK; | |
| 548 | + | |
| 549 | + return LIB3270_MESSAGE_NONE; | |
| 550 | + | |
| 551 | +} | |
| 552 | + | |
| 553 | +/** | |
| 554 | + * Check if terminal is ready for actions. | |
| 555 | + * | |
| 556 | + * @param h Session handle. | |
| 557 | + * | |
| 558 | + * @return Non zero if terminal is ready for commands. | |
| 559 | + * | |
| 560 | + */ | |
| 561 | +LIB3270_EXPORT int lib3270_is_ready(H3270 *hSession) | |
| 562 | +{ | |
| 563 | + return lib3270_lock_status(hSession) == LIB3270_MESSAGE_NONE; | |
| 564 | +} | |
| 565 | + | |
| 566 | + | |
| 531 | 567 | void status_changed(H3270 *session, LIB3270_STATUS id) |
| 532 | 568 | { |
| 533 | 569 | CHECK_SESSION_HANDLE(session); | ... | ... |
statusc.h
| ... | ... | @@ -35,7 +35,4 @@ LIB3270_INTERNAL void set_status(H3270 *session, OIA_FLAG id, Boolean on); |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | #define status_typeahead(h,on) set_status(h,OIA_FLAG_TYPEAHEAD,on) |
| 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 | 38 | ... | ... |