Commit 70cc9160b610bf309adbdaf199fe610039211ec6

Authored by Perry Werneck
1 parent 51f5abc6

Adding method to disable the "lock on operator error" feature.

src/core/keyboard/kybd.c
@@ -420,6 +420,8 @@ void kybd_in3270(H3270 *hSession, int GNUC_UNUSED(in3270), void GNUC_UNUSED(*dun @@ -420,6 +420,8 @@ void kybd_in3270(H3270 *hSession, int GNUC_UNUSED(in3270), void GNUC_UNUSED(*dun
420 420
421 /** 421 /**
422 * @brief Lock the keyboard because of an operator error. 422 * @brief Lock the keyboard because of an operator error.
  423 + *
  424 + * @see lib3270_set_lock_on_operator_error
423 */ 425 */
424 void operator_error(H3270 *hSession, int error_type) 426 void operator_error(H3270 *hSession, int error_type)
425 { 427 {
@@ -2258,3 +2260,7 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H327 @@ -2258,3 +2260,7 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H327
2258 return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock; 2260 return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock;
2259 } 2261 }
2260 2262
  2263 +LIB3270_EXPORT void lib3270_set_lock_on_operator_error(H3270 *hSession, int enable)
  2264 +{
  2265 + hSession->oerr_lock = (enable ? 1 : 0);
  2266 +}
@@ -1018,3 +1018,4 @@ static void query_reply_end(H3270 *hSession) @@ -1018,3 +1018,4 @@ static void query_reply_end(H3270 *hSession)
1018 net_output(hSession); 1018 net_output(hSession);
1019 kybd_inhibit(hSession,True); 1019 kybd_inhibit(hSession,True);
1020 } 1020 }
  1021 +
src/include/lib3270-internals.h
@@ -365,11 +365,11 @@ struct _h3270 @@ -365,11 +365,11 @@ struct _h3270
365 int extended : 1; 365 int extended : 1;
366 int typeahead : 1; 366 int typeahead : 1;
367 int numeric_lock : 1; 367 int numeric_lock : 1;
368 - int oerr_lock : 1;  
369 - int unlock_delay : 1; 368 + int oerr_lock : 1; ///< @brief If true, operator errors will lock the keyboard.
  369 + int unlock_delay : 1; ///< @brief If true the unlock delay feature is enabled. @see lib3270_set_unlock_delay
370 int auto_reconnect_inprogress : 1; 370 int auto_reconnect_inprogress : 1;
371 unsigned int colors : 5; 371 unsigned int colors : 5;
372 - int apl_mode : 1; 372 + int apl_mode : 1; ///< @brief If true enables APL mode.
373 int icrnl : 1; 373 int icrnl : 1;
374 int inlcr : 1; 374 int inlcr : 1;
375 int onlcr : 1; 375 int onlcr : 1;
src/include/lib3270/keyboard.h
@@ -71,6 +71,19 @@ @@ -71,6 +71,19 @@
71 71
72 LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession); 72 LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession);
73 73
  74 + /**
  75 + * @brief Set te operator error lock.
  76 + *
  77 + * If lock is enabled (the default), operator errors (typing into protected fields, insert overflow, etc.)
  78 + * will cause the keyboard to lock with an error message in the OIA (status line). If disabled, these errors
  79 + * will simply cause the terminal bell will ring, without any keyboard lock or message.
  80 + *
  81 + * @param hSession Session handle.
  82 + * @param enable Non zero to enable operator lock, zero to disable.
  83 + *
  84 + */
  85 + LIB3270_EXPORT void lib3270_set_lock_on_operator_error(H3270 *hSession, int enable);
  86 +
74 #ifdef __cplusplus 87 #ifdef __cplusplus
75 } 88 }
76 #endif 89 #endif