diff options
| author | fvogel <fvogelnew1@free.fr> | 2016-08-12 16:51:23 (GMT) |
|---|---|---|
| committer | fvogel <fvogelnew1@free.fr> | 2016-08-12 16:51:23 (GMT) |
| commit | a498656bff1b7ff55c949c4311b1bfb4c307c02e (patch) | |
| tree | 6a53ad9e903d3a3aac5cbd117e40c7d5982a5ba8 /win/tkWinX.c | |
| parent | 4fa07b0a11a1de74bd15b1ae9dcec8be210fcd34 (diff) | |
| download | tk-bug_2945130fff_shift.zip tk-bug_2945130fff_shift.tar.gz tk-bug_2945130fff_shift.tar.bz2 | |
Solution for differentiating left and right shift keys.bug_2945130fff_shift
Diffstat (limited to 'win/tkWinX.c')
| -rw-r--r-- | win/tkWinX.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/win/tkWinX.c b/win/tkWinX.c index 567b281..2f81ece 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -1323,6 +1323,21 @@ GetState( if (HIWORD(lParam) & KF_EXTENDED) { state |= EXTENDED_MASK; } + + /* + * Windows does not set the Extended flag for neither the left nor the right + * shift key. Since we need to distinguish later at event handling time + * which one was pressed, we force the Extended flag manually here so that + * KeycodeToKeysym() in tkWinKey.c can return the correct left or right + * keysym. Detection is based on the scan code contained in lParam. + * This is a bit of a hack but there is no other way that would work + * for both KeyPress and KeyRelease events. + */ + + if ((wParam == VK_SHIFT) && + ((HIWORD(lParam) & 0xFF) != MapVirtualKey(VK_LSHIFT, 0))) { + state |= EXTENDED_MASK; + } } return state; } |
