diff options
author | Luca Bacci <luca.bacci982@gmail.com> | 2022-01-03 15:03:55 +0100 |
---|---|---|
committer | Luca Bacci <luca.bacci982@gmail.com> | 2022-01-03 15:08:58 +0100 |
commit | 46c12b2c922d5592cedd29624cbf3be6b4411084 (patch) | |
tree | 909c87cf2e37d893051d0d6ba2fcbd8e1b2250ea | |
parent | 728f0e13a89f03331b971a90b3410ef62bc83258 (diff) | |
download | gtk+-46c12b2c922d5592cedd29624cbf3be6b4411084.tar.gz |
Winpointer: Fix keyboard state
The dwKeyStates field of the POINTER_INFO structure is
always set to 0 no matter what.
Use GetKeyState instead.
Fixes https://gitlab.com/inkscape/inbox/-/issues/5946
-rw-r--r-- | gdk/win32/gdkdevicemanager-win32.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c index d8f01764f2..f4c258b3c8 100644 --- a/gdk/win32/gdkdevicemanager-win32.c +++ b/gdk/win32/gdkdevicemanager-win32.c @@ -1762,10 +1762,12 @@ winpointer_make_event (GdkDisplay *display, x /= impl->window_scale; y /= impl->window_scale; + /* info->dwKeyStates is not reliable. We shall use + * GetKeyState here even for Ctrl and Shift. */ state = 0; - if (info->dwKeyStates & POINTER_MOD_CTRL) + if (GetKeyState (VK_CONTROL) < 0) state |= GDK_CONTROL_MASK; - if (info->dwKeyStates & POINTER_MOD_SHIFT) + if (GetKeyState (VK_SHIFT) < 0) state |= GDK_SHIFT_MASK; if (GetKeyState (VK_MENU) < 0) state |= GDK_MOD1_MASK; |