Commit 092f28fb6e0ab3ec65f40d4a2e15bd8291d70d59

Authored by Perry Werneck
1 parent 7f9b2993
Exists in master and in 1 other branch develop

Fixing 'kpalternative' option.

src/terminal/drawing/oia.c
... ... @@ -762,6 +762,9 @@ void v3270_update_cursor(H3270 *session, unsigned short row, unsigned short col,
762 762 if(!terminal->surface)
763 763 return;
764 764  
  765 + // Reset input context
  766 + gtk_im_context_reset(terminal->input_method);
  767 +
765 768 // Update cursor rectangle
766 769 saved = terminal->cursor.rect;
767 770  
... ...
src/terminal/keyboard.c
... ... @@ -90,7 +90,7 @@
90 90 #ifdef DEBUG
91 91 {
92 92 g_autofree gchar * keyname = gtk_accelerator_name(event->keyval,event->state);
93   - debug("%s Keyval: %d (%s) State: %04x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  93 + debug("%s Keyval: %d (%s) State: %04x %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
94 94 __FUNCTION__,
95 95 event->keyval,
96 96 gdk_keyval_name(event->keyval),
... ... @@ -109,19 +109,32 @@
109 109 event->state & GDK_BUTTON4_MASK ? " GDK_BUTTON4_MASK" : "",
110 110 event->state & GDK_BUTTON5_MASK ? " GDK_BUTTON5_MASK" : "",
111 111 event->state & GDK_RELEASE_MASK ? " GDK_RELEASE_MASK" : "",
112   - event->state & GDK_MODIFIER_MASK ? " GDK_MODIFIER_MASK" : ""
  112 + event->state & GDK_MODIFIER_MASK ? " GDK_MODIFIER_MASK" : "",
  113 + event->state & GDK_NUMLOCK_MASK ? " GDK_NUMLOCK_MASK" : ""
113 114 );
114 115  
115 116 }
116 117 #endif // DEBUG
117 118  
118   - if(gtk_im_context_filter_keypress(terminal->input_method,event))
119   - return TRUE;
  119 + // Check +/- keyboard redirection
  120 + if(lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_KP_ALTERNATIVE) && (event->state & GDK_NUMLOCK_MASK)) {
  121 +
  122 + switch(event->keyval) {
  123 + case GDK_KP_Add:
  124 + debug("%s: Calling lib3270_nextfield",__FUNCTION__);
  125 + gtk_im_context_reset(terminal->input_method);
  126 + lib3270_nextfield(terminal->host);
  127 + return TRUE;
120 128  
121   - /*
122   - if(!gtk_accelerator_valid(event->keyval,event->state))
123   - return FALSE;
124   - */
  129 + case GDK_KP_Subtract:
  130 + debug("%s: Calling lib3270_previousfield",__FUNCTION__);
  131 + gtk_im_context_reset(terminal->input_method);
  132 + lib3270_previousfield(terminal->host);
  133 + return TRUE;
  134 +
  135 + }
  136 +
  137 + }
125 138  
126 139 // Signal to the application.
127 140 gboolean handled = FALSE;
... ... @@ -140,41 +153,22 @@
140 153 }
141 154 #endif // DEBUG
142 155  
143   - if(handled)
  156 + if(handled) {
  157 + gtk_im_context_reset(terminal->input_method);
144 158 return TRUE;
145   -
  159 + }
146 160  
147 161 // Check for acelerator
148 162 const V3270Accelerator * accelerator = v3270_accelerator_map_lookup_entry(widget, event->keyval, event->state);
149 163 if(accelerator)
150 164 {
151 165 debug("Found accelerator %s",v3270_accelerator_get_name(accelerator));
  166 + gtk_im_context_reset(terminal->input_method);
152 167 v3270_accelerator_activate(accelerator,widget);
153 168 return TRUE;
154 169 }
155 170  
156   -
157   - // Check +/- keyboard redirection
158   - if(lib3270_get_toggle(terminal->host,LIB3270_TOGGLE_KP_ALTERNATIVE) && (event->state & GDK_NUMLOCK_MASK)) {
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);
171   - return TRUE;
172   -
173   - }
174   -
175   - }
176   -
177   - return FALSE;
  171 + return gtk_im_context_filter_keypress(terminal->input_method,event);
178 172  
179 173 }
180 174  
... ...
src/terminal/widget.c
... ... @@ -816,6 +816,9 @@ gboolean v3270_focus_out_event(GtkWidget *widget, GdkEventFocus *event)
816 816  
817 817 gtk_im_context_focus_out(terminal->input_method);
818 818  
  819 + terminal->keyflags &= ~KEY_FLAG_ALT;
  820 + v3270_draw_alt_status(terminal);
  821 +
819 822 return notify_focus(widget,event);
820 823 }
821 824  
... ...