summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-08 03:34:51 +0200
committerSven Gothel <[email protected]>2013-04-08 03:34:51 +0200
commit3052de236eb08a27286f20d52671bb40dbdd8875 (patch)
treec189e9bbebca14c234031a5f4084f104e86c85af
parent64fd6eef879f7453b491a9df421faf2d47da9d7f (diff)
Bug 641 NEWT/X11: Deliver 'J_VK_WINDOWS'; keySym is layout independent for dead-keys (zero keyChar); For 'unshifted' keySym's also unmask Ctrl and Mod* states
-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);