Commit bff593012d4065570279a765096d9461cd136a22

Authored by Perry Werneck
1 parent 767ae97b
Exists in master and in 1 other branch develop

Reactivating keypad actions.

src/terminal/actions/table.c
... ... @@ -33,14 +33,16 @@
33 33 #include <v3270/selection.h>
34 34 #include <terminal.h>
35 35  
36   - static int fire_kp_add_action(GtkWidget *widget, const struct _v3270_action * action);
37   - static int fire_kp_sub_action(GtkWidget *widget, const struct _v3270_action * action);
  36 +// static int fire_kp_add_action(GtkWidget *widget, const struct _v3270_action * action);
  37 +// static int fire_kp_sub_action(GtkWidget *widget, const struct _v3270_action * action);
38 38  
39 39 /*--[ Implement ]------------------------------------------------------------------------------------*/
40 40  
41 41 LIB3270_EXPORT const V3270_ACTION * v3270_get_actions() {
42 42  
43 43 static const V3270_ACTION actions[] = {
  44 +
  45 + /*
44 46 {
45 47 .name = "keypad-add",
46 48 .keys = "<Mod2>KP_Add",
... ... @@ -53,6 +55,7 @@
53 55 .group = LIB3270_ACTION_GROUP_ONLINE,
54 56 .activate = fire_kp_sub_action
55 57 },
  58 + */
56 59  
57 60 // Standard Clipboard actions
58 61 {
... ... @@ -321,6 +324,7 @@
321 324  
322 325 }
323 326  
  327 + /*
324 328 int fire_kp_add_action(GtkWidget *widget, const struct _v3270_action G_GNUC_UNUSED(* action)) {
325 329  
326 330 if(v3270_get_toggle(widget,LIB3270_TOGGLE_KP_ALTERNATIVE))
... ... @@ -332,6 +336,7 @@
332 336  
333 337 }
334 338  
  339 +
335 340 int fire_kp_sub_action(GtkWidget *widget, const struct _v3270_action G_GNUC_UNUSED(* action)) {
336 341  
337 342 if(v3270_get_toggle(widget,LIB3270_TOGGLE_KP_ALTERNATIVE))
... ... @@ -342,3 +347,4 @@
342 347 return 0;
343 348  
344 349 }
  350 +*/
... ...
src/terminal/keyboard.c
... ... @@ -48,6 +48,10 @@
48 48 #include <gdk/gdkkeysyms.h>
49 49 #endif
50 50  
  51 + #ifndef GDK_NUMLOCK_MASK
  52 + #define GDK_NUMLOCK_MASK GDK_MOD2_MASK
  53 + #endif
  54 +
51 55 /*--[ Implement ]------------------------------------------------------------------------------------*/
52 56  
53 57 #define keyval_is_alt() (event->keyval == GDK_Alt_L || event->keyval == GDK_Meta_L || event->keyval == GDK_ISO_Level3_Shift)
... ... @@ -135,11 +139,12 @@
135 139 debug("Keyboard action \"%s\" was %s",key_name,handled ? "Handled" : "Not handled");
136 140 }
137 141 #endif // DEBUG
  142 +
138 143 if(handled)
139 144 return TRUE;
140 145  
141 146  
142   - // Check for s
  147 + // Check for acelerator
143 148 const V3270Accelerator * accelerator = v3270_accelerator_map_lookup_entry(widget, event->keyval, event->state);
144 149 if(accelerator)
145 150 {
... ... @@ -148,22 +153,26 @@
148 153 return TRUE;
149 154 }
150 155  
151   - /*
152   - if(event->keyval >= GDK_F1 && event->keyval <= GDK_F12 && !(event->state & (GDK_CONTROL_MASK|GDK_MOD1_MASK)))
153   - {
154   - // It's a PFKey Action.
155   - int pfcode = (event->keyval - GDK_F1) + ((event->state & GDK_SHIFT_MASK) ? 13 : 1);
156 156  
157   - if(pfcode > 0 && pfcode < 25)
158   - {
159   - if(lib3270_pfkey(GTK_V3270(widget)->host,pfcode))
160   - gdk_display_beep(gtk_widget_get_display(widget));
  157 + // Check +/- keyboard redirection
  158 + if(lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_KP_ALTERNATIVE) && (event->state & GDK_NUMLOCK_MASK)) {
161 159  
  160 + debug("%s: Checking keypad special actions", __FUNCTION__);
  161 +
  162 + switch(event->keyval) {
  163 + case GDK_KP_Add:
  164 + debug("%s: Calling lib3270_nextfield",__FUNCTION__);
  165 + lib3270_nextfield(terminal->host);
  166 + return TRUE;
  167 +
  168 + case GDK_KP_Subtract:
  169 + debug("%s: Calling lib3270_previousfield",__FUNCTION__);
  170 + lib3270_previousfield(terminal->host);
162 171 return TRUE;
  172 +
163 173 }
164 174  
165 175 }
166   - */
167 176  
168 177 return FALSE;
169 178  
... ...