aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/native/X11Display.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/newt/native/X11Display.c b/src/newt/native/X11Display.c
index a2df0d2e2..903188467 100644
--- a/src/newt/native/X11Display.c
+++ b/src/newt/native/X11Display.c
@@ -96,6 +96,9 @@ static short X11KeySym2NewtVKey(KeySym keySym) {
return J_VK_ALT;
case XK_Alt_R:
return J_VK_ALT_GRAPH;
+ case XK_Super_L:
+ case XK_Super_R:
+ return J_VK_WINDOWS;
case XK_Pause:
return J_VK_PAUSE;
case XK_Caps_Lock:
@@ -163,6 +166,8 @@ static short X11KeySym2NewtVKey(KeySym keySym) {
return keySym;
}
+#define ShiftCtrlModMask ( ShiftMask | ControlMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask )
+
static jboolean altGraphDown = JNI_FALSE;
static jint X11InputState2NewtModifiers(unsigned int xstate, jshort javaVKey, jboolean keyDown) {
@@ -443,9 +448,17 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessage
keyString = (*env)->NewStringUTF(env, text);
}
- evt.xkey.state = evt.xkey.state & ~ShiftMask; // clear shift
- XLookupString(&evt.xkey, text, 0, &unShiftedKeySym, NULL);
- // unShiftedKeySym = XLookupKeysym(&evt.xkey, 0 /* index ? */);
+ if( 0 == keyChar ) {
+ // Use keyCode's keySym for dead-key (aka modifiers, etc)
+ unShiftedKeySym = keySym;
+ } else if( 0 == ( evt.xkey.state & ShiftCtrlModMask ) ) {
+ // Use non modded keySym
+ unShiftedKeySym = shiftedKeySym;
+ } else {
+ evt.xkey.state = evt.xkey.state & ~ShiftCtrlModMask; // clear shift, ctrl and Mod*
+ XLookupString(&evt.xkey, text, 0, &unShiftedKeySym, NULL);
+ // unShiftedKeySym = XLookupKeysym(&evt.xkey, 0 /* index ? */);
+ }
javaVKeyNN = X11KeySym2NewtVKey(unShiftedKeySym);
javaVKeyUS = X11KeySym2NewtVKey(keySym);