From: Luca Bacci Date: Wed, 21 Jun 2023 14:14:56 +0000 (+0200) Subject: GdkWin32: Fix keyboard state for WinPointer input X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~81^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3912d6aba9245f632069fabf1e23cc470d857aa4;p=gtk4.git GdkWin32: Fix keyboard state for WinPointer input The dwKeyStates field of the POINTER_INFO structure is always set to 0, no matter what. Use GetKeyState instead. Forward-port of !4327 to GTK4 --- diff --git a/gdk/win32/gdkinput-winpointer.c b/gdk/win32/gdkinput-winpointer.c index 0782743453..1a9e6bbff5 100644 --- a/gdk/win32/gdkinput-winpointer.c +++ b/gdk/win32/gdkinput-winpointer.c @@ -271,9 +271,10 @@ winpointer_make_event (GdkDeviceWinpointer *device, y /= impl->surface_scale; state = 0; - if (info->dwKeyStates & POINTER_MOD_CTRL) + /* Note that info->dwKeyStates is not reliable, use GetKeyState() */ + 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_ALT_MASK;