From 70cc9160b610bf309adbdaf199fe610039211ec6 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 20 Aug 2019 14:09:07 -0300 Subject: [PATCH] Adding method to disable the "lock on operator error" feature. --- src/core/keyboard/kybd.c | 6 ++++++ src/core/sf.c | 1 + src/include/lib3270-internals.h | 6 +++--- src/include/lib3270/keyboard.h | 13 +++++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/core/keyboard/kybd.c b/src/core/keyboard/kybd.c index 40951b7..a3c7dfd 100644 --- a/src/core/keyboard/kybd.c +++ b/src/core/keyboard/kybd.c @@ -420,6 +420,8 @@ void kybd_in3270(H3270 *hSession, int GNUC_UNUSED(in3270), void GNUC_UNUSED(*dun /** * @brief Lock the keyboard because of an operator error. + * + * @see lib3270_set_lock_on_operator_error */ void operator_error(H3270 *hSession, int error_type) { @@ -2258,3 +2260,7 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H327 return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock; } +LIB3270_EXPORT void lib3270_set_lock_on_operator_error(H3270 *hSession, int enable) +{ + hSession->oerr_lock = (enable ? 1 : 0); +} diff --git a/src/core/sf.c b/src/core/sf.c index 8990984..4e7a412 100644 --- a/src/core/sf.c +++ b/src/core/sf.c @@ -1018,3 +1018,4 @@ static void query_reply_end(H3270 *hSession) net_output(hSession); kybd_inhibit(hSession,True); } + diff --git a/src/include/lib3270-internals.h b/src/include/lib3270-internals.h index 8b35786..4a1c826 100644 --- a/src/include/lib3270-internals.h +++ b/src/include/lib3270-internals.h @@ -365,11 +365,11 @@ struct _h3270 int extended : 1; int typeahead : 1; int numeric_lock : 1; - int oerr_lock : 1; - int unlock_delay : 1; + int oerr_lock : 1; ///< @brief If true, operator errors will lock the keyboard. + int unlock_delay : 1; ///< @brief If true the unlock delay feature is enabled. @see lib3270_set_unlock_delay int auto_reconnect_inprogress : 1; unsigned int colors : 5; - int apl_mode : 1; + int apl_mode : 1; ///< @brief If true enables APL mode. int icrnl : 1; int inlcr : 1; int onlcr : 1; diff --git a/src/include/lib3270/keyboard.h b/src/include/lib3270/keyboard.h index 8fa0a2c..57f1fc2 100644 --- a/src/include/lib3270/keyboard.h +++ b/src/include/lib3270/keyboard.h @@ -71,6 +71,19 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_get_keyboard_lock_state(H3270 *hSession); + /** + * @brief Set te operator error lock. + * + * If lock is enabled (the default), operator errors (typing into protected fields, insert overflow, etc.) + * will cause the keyboard to lock with an error message in the OIA (status line). If disabled, these errors + * will simply cause the terminal bell will ring, without any keyboard lock or message. + * + * @param hSession Session handle. + * @param enable Non zero to enable operator lock, zero to disable. + * + */ + LIB3270_EXPORT void lib3270_set_lock_on_operator_error(H3270 *hSession, int enable); + #ifdef __cplusplus } #endif -- libgit2 0.21.2