- guint upper = gdk_keyval_to_upper( (guint)keysym );
- keysym = (upper != 0 ? upper : keysym ); /* to be MSW compatible */
- key_code = (guint)keysym;
+ keysym = (KeySym)event->string[0];
+ }
+ else if ( (keysym & 0xFF) != keysym )
+ {
+ // non ASCII key, what to do?
+
+ if ( event->type == GDK_KEY_RELEASE )
+ {
+ // reuse the one from the last keypress if any
+ if ( keysym == s_lastKeyPress.keysym )
+ {
+ key_code = s_lastKeyPress.keycode;
+
+ // skip "return 0"
+ break;
+ }
+ }
+
+ // ignore this one, we don't know it
+ return 0;
+ }
+ //else: ASCII key, ok
+
+ guint upper = gdk_keyval_to_upper( (guint)keysym );
+ key_code = upper ? upper : keysym;
+
+ if ( event->type == GDK_KEY_PRESS )
+ {
+ // remember it to be reused below later
+ s_lastKeyPress.keysym = keysym;
+ s_lastKeyPress.keycode = key_code;