From bff593012d4065570279a765096d9461cd136a22 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Tue, 13 Oct 2020 18:39:52 -0300 Subject: [PATCH] Reactivating keypad actions. --- src/terminal/actions/table.c | 10 ++++++++-- src/terminal/keyboard.c | 31 ++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/terminal/actions/table.c b/src/terminal/actions/table.c index 360e5c1..a610006 100644 --- a/src/terminal/actions/table.c +++ b/src/terminal/actions/table.c @@ -33,14 +33,16 @@ #include #include - static int fire_kp_add_action(GtkWidget *widget, const struct _v3270_action * action); - static int fire_kp_sub_action(GtkWidget *widget, const struct _v3270_action * action); +// static int fire_kp_add_action(GtkWidget *widget, const struct _v3270_action * action); +// static int fire_kp_sub_action(GtkWidget *widget, const struct _v3270_action * action); /*--[ Implement ]------------------------------------------------------------------------------------*/ LIB3270_EXPORT const V3270_ACTION * v3270_get_actions() { static const V3270_ACTION actions[] = { + + /* { .name = "keypad-add", .keys = "KP_Add", @@ -53,6 +55,7 @@ .group = LIB3270_ACTION_GROUP_ONLINE, .activate = fire_kp_sub_action }, + */ // Standard Clipboard actions { @@ -321,6 +324,7 @@ } + /* int fire_kp_add_action(GtkWidget *widget, const struct _v3270_action G_GNUC_UNUSED(* action)) { if(v3270_get_toggle(widget,LIB3270_TOGGLE_KP_ALTERNATIVE)) @@ -332,6 +336,7 @@ } + int fire_kp_sub_action(GtkWidget *widget, const struct _v3270_action G_GNUC_UNUSED(* action)) { if(v3270_get_toggle(widget,LIB3270_TOGGLE_KP_ALTERNATIVE)) @@ -342,3 +347,4 @@ return 0; } +*/ diff --git a/src/terminal/keyboard.c b/src/terminal/keyboard.c index cb22515..fc0b0d0 100644 --- a/src/terminal/keyboard.c +++ b/src/terminal/keyboard.c @@ -48,6 +48,10 @@ #include #endif + #ifndef GDK_NUMLOCK_MASK + #define GDK_NUMLOCK_MASK GDK_MOD2_MASK + #endif + /*--[ Implement ]------------------------------------------------------------------------------------*/ #define keyval_is_alt() (event->keyval == GDK_Alt_L || event->keyval == GDK_Meta_L || event->keyval == GDK_ISO_Level3_Shift) @@ -135,11 +139,12 @@ debug("Keyboard action \"%s\" was %s",key_name,handled ? "Handled" : "Not handled"); } #endif // DEBUG + if(handled) return TRUE; - // Check for s + // Check for acelerator const V3270Accelerator * accelerator = v3270_accelerator_map_lookup_entry(widget, event->keyval, event->state); if(accelerator) { @@ -148,22 +153,26 @@ return TRUE; } - /* - if(event->keyval >= GDK_F1 && event->keyval <= GDK_F12 && !(event->state & (GDK_CONTROL_MASK|GDK_MOD1_MASK))) - { - // It's a PFKey Action. - int pfcode = (event->keyval - GDK_F1) + ((event->state & GDK_SHIFT_MASK) ? 13 : 1); - if(pfcode > 0 && pfcode < 25) - { - if(lib3270_pfkey(GTK_V3270(widget)->host,pfcode)) - gdk_display_beep(gtk_widget_get_display(widget)); + // Check +/- keyboard redirection + if(lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_KP_ALTERNATIVE) && (event->state & GDK_NUMLOCK_MASK)) { + debug("%s: Checking keypad special actions", __FUNCTION__); + + switch(event->keyval) { + case GDK_KP_Add: + debug("%s: Calling lib3270_nextfield",__FUNCTION__); + lib3270_nextfield(terminal->host); + return TRUE; + + case GDK_KP_Subtract: + debug("%s: Calling lib3270_previousfield",__FUNCTION__); + lib3270_previousfield(terminal->host); return TRUE; + } } - */ return FALSE; -- libgit2 0.21.2