summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-08 07:56:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-09-08 07:56:58 (GMT)
commitb9e7a10e1ce61e6cdcf964487e5ecacfeb531311 (patch)
tree6957f3a17d7f62d0261409847c98242481ba0588
parent444913e6f0bc2742ea612f6c61fb8b56b53d3088 (diff)
parent571a9ffc9dec8cbd9963a3c826b1467dc3997b77 (diff)
downloadtk-b9e7a10e1ce61e6cdcf964487e5ecacfeb531311.zip
tk-b9e7a10e1ce61e6cdcf964487e5ecacfeb531311.tar.gz
tk-b9e7a10e1ce61e6cdcf964487e5ecacfeb531311.tar.bz2
merge core-8-6-branch
-rw-r--r--win/tkWinKey.c30
-rw-r--r--win/tkWinX.c6
2 files changed, 19 insertions, 17 deletions
diff --git a/win/tkWinKey.c b/win/tkWinKey.c
index 64f8cd4..2698c4d 100644
--- a/win/tkWinKey.c
+++ b/win/tkWinKey.c
@@ -346,18 +346,24 @@ KeycodeToKeysym(
/*
* Windows only gives us an undifferentiated VK_CONTROL code (for
* example) when either Control key is pressed. To distinguish between
- * left and right, we have to query the state of one of the two to
- * determine which was actually pressed. So if the keycode indicates
- * Control, Shift, or Menu (the key that everybody else calls Alt), do
- * this extra test. If the right-side key was pressed, return the
- * appropriate keycode. Otherwise, we fall through and rely on the
- * keymap table to hold the correct keysym value.
+ * left and right, we use the Extended flag. Indeed, the right Control
+ * and Alt (aka Menu) keys are such extended keys (which their left
+ * counterparts are not).
+ * Regarding the shift case, Windows does not set the Extended flag for
+ * the neither the left nor the right shift key. As a consequence another
+ * way to distinguish between the two keys is to query the state of one
+ * of the two to determine which was actually pressed. So if the keycode
+ * indicates Shift, do this extra test. If the right-side key was
+ * pressed, return the appropriate keycode. Otherwise, we fall through
+ * and rely on the keymap table to hold the correct keysym value.
+ * Note: this little trick only works for KeyPress, not for KeyRelease,
+ * for reasons stated in bug [2945130]
*/
case VK_CONTROL:
- if (GetKeyState(VK_RCONTROL) & 0x80) {
- return XK_Control_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Control_R;
+ }
break;
case VK_SHIFT:
if (GetKeyState(VK_RSHIFT) & 0x80) {
@@ -365,9 +371,9 @@ KeycodeToKeysym(
}
break;
case VK_MENU:
- if (GetKeyState(VK_RMENU) & 0x80) {
- return XK_Alt_R;
- }
+ if (state & EXTENDED_MASK) {
+ return XK_Alt_R;
+ }
break;
}
return keymap[keycode];
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 1e66620..bb60a2d 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1343,11 +1343,7 @@ GetState(
state &= ~mask;
}
if (HIWORD(lParam) & KF_EXTENDED) {
- if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
- state |= EXTENDED_MASK;
- } else {
- state &= ~EXTENDED_MASK;
- }
+ state |= EXTENDED_MASK;
}
}
return state;