Commit 0f4fd014473dc7374b0129efdfc1b980496b3118
1 parent
f5c3e838
Exists in
master
and in
3 other branches
Adding events for cursor state.
Showing
7 changed files
with
30 additions
and
25 deletions
Show diff stats
src/core/actions/table.c
| ... | ... | @@ -260,8 +260,8 @@ |
| 260 | 260 | .summary = N_( "Paste file." ), |
| 261 | 261 | .activate = paste_file, |
| 262 | 262 | |
| 263 | - .group = LIB3270_ACTION_GROUP_ONLINE, | |
| 264 | - .activatable = lib3270_is_connected | |
| 263 | + .group = LIB3270_ACTION_GROUP_LOCK_STATE, | |
| 264 | + .activatable = lib3270_is_unlocked | |
| 265 | 265 | }, |
| 266 | 266 | |
| 267 | 267 | // |
| ... | ... | @@ -397,8 +397,8 @@ |
| 397 | 397 | .summary = N_( "Backspaces the cursor until it hits the front of a word." ), |
| 398 | 398 | .activate = lib3270_deleteword, |
| 399 | 399 | |
| 400 | - .group = LIB3270_ACTION_GROUP_ONLINE, | |
| 401 | - .activatable = lib3270_is_connected | |
| 400 | + .group = LIB3270_ACTION_GROUP_LOCK_STATE, | |
| 401 | + .activatable = lib3270_is_unlocked | |
| 402 | 402 | }, |
| 403 | 403 | |
| 404 | 404 | { |
| ... | ... | @@ -411,8 +411,8 @@ |
| 411 | 411 | .summary = N_( "Delete field" ), |
| 412 | 412 | .activate = lib3270_deletefield, |
| 413 | 413 | |
| 414 | - .group = LIB3270_ACTION_GROUP_ONLINE, | |
| 415 | - .activatable = lib3270_is_formatted | |
| 414 | + .group = LIB3270_ACTION_GROUP_LOCK_STATE, | |
| 415 | + .activatable = lib3270_is_unlocked | |
| 416 | 416 | }, |
| 417 | 417 | |
| 418 | 418 | |
| ... | ... | @@ -613,8 +613,8 @@ |
| 613 | 613 | .summary = NULL, |
| 614 | 614 | .activate = lib3270_paste_next, |
| 615 | 615 | |
| 616 | - .group = LIB3270_ACTION_GROUP_ONLINE, | |
| 617 | - .activatable = lib3270_is_connected | |
| 616 | + .group = LIB3270_ACTION_GROUP_LOCK_STATE, | |
| 617 | + .activatable = lib3270_is_unlocked | |
| 618 | 618 | }, |
| 619 | 619 | |
| 620 | 620 | { | ... | ... |
src/core/keyboard/kybd.c
| ... | ... | @@ -325,7 +325,7 @@ static void kybdlock_set(H3270 *hSession, unsigned int bits) |
| 325 | 325 | #endif |
| 326 | 326 | if ((hSession->kybdlock ^ bits) & KL_DEFERRED_UNLOCK) |
| 327 | 327 | { |
| 328 | - /* Turned on deferred unlock. */ | |
| 328 | + // Turned on deferred unlock. | |
| 329 | 329 | hSession->unlock_delay_time = time(NULL); |
| 330 | 330 | } |
| 331 | 331 | hSession->kybdlock = n; |
| ... | ... | @@ -498,7 +498,7 @@ static void key_AID(H3270 *hSession, unsigned char aid_code) |
| 498 | 498 | if (!IN_SSCP || aid_code != AID_CLEAR) |
| 499 | 499 | { |
| 500 | 500 | status_twait(hSession); |
| 501 | - mcursor_waiting(hSession); | |
| 501 | + mcursor_set(hSession,LIB3270_POINTER_WAITING); | |
| 502 | 502 | lib3270_set_toggle(hSession,LIB3270_TOGGLE_INSERT,0); |
| 503 | 503 | kybdlock_set(hSession,KL_OIA_TWAIT | KL_OIA_LOCKED); |
| 504 | 504 | } |
| ... | ... | @@ -1073,7 +1073,7 @@ void do_reset(H3270 *hSession, Boolean explicit) |
| 1073 | 1073 | |
| 1074 | 1074 | /* Clean up other modes. */ |
| 1075 | 1075 | status_reset(hSession); |
| 1076 | - mcursor_normal(hSession); | |
| 1076 | + mcursor_set(hSession,LIB3270_POINTER_UNLOCKED); | |
| 1077 | 1077 | |
| 1078 | 1078 | } |
| 1079 | 1079 | ... | ... |
src/core/screen.c
| ... | ... | @@ -830,15 +830,16 @@ void popup_system_error(H3270 *session, const char *title, const char *message, |
| 830 | 830 | va_end(args); |
| 831 | 831 | } |
| 832 | 832 | |
| 833 | -void mcursor_set(H3270 *session,LIB3270_POINTER m) | |
| 833 | +void mcursor_set(H3270 *hSession,LIB3270_POINTER m) | |
| 834 | 834 | { |
| 835 | - CHECK_SESSION_HANDLE(session); | |
| 836 | - | |
| 837 | - if(session->pointer != ((unsigned short) m)) { | |
| 835 | + if(hSession->pointer != ((unsigned short) m)) { | |
| 838 | 836 | |
| 839 | 837 | // Pointer changed |
| 840 | - session->pointer = (unsigned short) m; | |
| 841 | - session->cbk.cursor(session,m & 0x03); | |
| 838 | + hSession->pointer = (unsigned short) m; | |
| 839 | + hSession->cbk.cursor(hSession,m & 0x03); | |
| 840 | + | |
| 841 | + // Notify lock state change. | |
| 842 | + lib3270_notify_actions(hSession, LIB3270_ACTION_GROUP_LOCK_STATE); | |
| 842 | 843 | |
| 843 | 844 | } |
| 844 | 845 | } | ... | ... |
src/core/state.c
src/include/lib3270.h
| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | |
| 52 | 52 | #define LIB3270_AUTOPTR_FUNC_NAME(TypeName) lib3270_autoptr_cleanup_##TypeName |
| 53 | 53 | #define lib3270_autoptr(TypeName) TypeName * __attribute__ ((__cleanup__(LIB3270_AUTOPTR_FUNC_NAME(TypeName)))) |
| 54 | - | |
| 54 | + | |
| 55 | 55 | #endif // __GNUC__ |
| 56 | 56 | |
| 57 | 57 | #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || defined (__clang__) |
| ... | ... | @@ -218,9 +218,9 @@ |
| 218 | 218 | */ |
| 219 | 219 | typedef enum _LIB3270_POINTER |
| 220 | 220 | { |
| 221 | - LIB3270_POINTER_UNLOCKED, /**< @brief Ready for user actions */ | |
| 222 | - LIB3270_POINTER_WAITING, /**< @brief Waiting for host */ | |
| 223 | - LIB3270_POINTER_LOCKED, /**< @brief Locked, can't receive user actions */ | |
| 221 | + LIB3270_POINTER_UNLOCKED, ///< @brief Ready for user actions | |
| 222 | + LIB3270_POINTER_WAITING, ///< @brief Waiting for host | |
| 223 | + LIB3270_POINTER_LOCKED, ///< @brief Locked, can't receive user actions | |
| 224 | 224 | |
| 225 | 225 | LIB3270_POINTER_PROTECTED, |
| 226 | 226 | LIB3270_POINTER_MOVE_SELECTION, |
| ... | ... | @@ -993,6 +993,8 @@ |
| 993 | 993 | LIB3270_EXPORT int lib3270_is_connected(const H3270 *h); |
| 994 | 994 | LIB3270_EXPORT int lib3270_is_disconnected(const H3270 *h); |
| 995 | 995 | |
| 996 | + LIB3270_EXPORT int lib3270_is_unlocked(const H3270 *h); | |
| 997 | + | |
| 996 | 998 | LIB3270_EXPORT int lib3270_has_active_script(const H3270 *h); |
| 997 | 999 | LIB3270_EXPORT int lib3270_get_typeahead(const H3270 *h); |
| 998 | 1000 | LIB3270_EXPORT int lib3270_get_undera(const H3270 *h); | ... | ... |
src/include/lib3270/actions.h
| ... | ... | @@ -39,6 +39,7 @@ |
| 39 | 39 | LIB3270_ACTION_GROUP_ONLINE, ///< @brief Action requires online state. |
| 40 | 40 | LIB3270_ACTION_GROUP_OFFLINE, ///< @brief Action requires offline state. |
| 41 | 41 | LIB3270_ACTION_GROUP_SELECTION, ///< @brief Action depends on selection. |
| 42 | + LIB3270_ACTION_GROUP_LOCK_STATE, ///< @brief Action depends on keyboard lock state. | |
| 42 | 43 | |
| 43 | 44 | LIB3270_ACTION_GROUP_CUSTOM ///< @brief Custom group/Number of groups. |
| 44 | 45 | } LIB3270_ACTION_GROUP; | ... | ... |
src/include/screenc.h
| ... | ... | @@ -43,10 +43,6 @@ |
| 43 | 43 | LIB3270_INTERNAL int screen_init(H3270 *session); |
| 44 | 44 | LIB3270_INTERNAL void mcursor_set(H3270 *session,LIB3270_POINTER m); |
| 45 | 45 | |
| 46 | -#define mcursor_locked(x) mcursor_set(x,LIB3270_POINTER_LOCKED) | |
| 47 | -#define mcursor_normal(x) mcursor_set(x,LIB3270_POINTER_UNLOCKED) | |
| 48 | -#define mcursor_waiting(x) mcursor_set(x,LIB3270_POINTER_WAITING) | |
| 49 | - | |
| 50 | 46 | LIB3270_INTERNAL void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE_ID ix, unsigned char value, LIB3270_TOGGLE_TYPE reason); |
| 51 | 47 | LIB3270_INTERNAL void set_viewsize(H3270 *session, unsigned int rows, unsigned int cols); |
| 52 | 48 | ... | ... |