summaryrefslogtreecommitdiff
path: root/hw/xwin/winkeybd.c
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-07-05 17:52:35 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2005-07-05 17:52:35 +0000
commitd72fef26d44e649f39a56730830148d48d77ee9e (patch)
tree18283342486802e2d2b67cc8b3a256a41fb6234b /hw/xwin/winkeybd.c
parent0f2c8221c938ce8eebd9f0e111a6b87223c18f9e (diff)
Fix simultanious presses of Left and Right Control and Shift keys.
https://bugs.freedesktop.org/show_bug.cgi?id=3677
Diffstat (limited to 'hw/xwin/winkeybd.c')
-rw-r--r--hw/xwin/winkeybd.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index e52337956..3756a4432 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -612,3 +612,39 @@ winSendKeyEvent (DWORD dwKey, Bool fDown)
xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE;
mieqEnqueue (&xCurrentEvent);
}
+
+BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
+{
+ switch (wParam)
+ {
+ case VK_CONTROL:
+ if ((lParam & 0x1ff0000) == 0x11d0000 && g_winKeyState[KEY_RCtrl])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x01d0000 && g_winKeyState[KEY_LCtrl])
+ return TRUE;
+ break;
+ case VK_SHIFT:
+ if ((lParam & 0x1ff0000) == 0x0360000 && g_winKeyState[KEY_ShiftR])
+ return TRUE;
+ if ((lParam & 0x1ff0000) == 0x02a0000 && g_winKeyState[KEY_ShiftL])
+ return TRUE;
+ break;
+ default:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/* Only on shift release message is sent even if both are pressed.
+ * Fix this here
+ */
+void winFixShiftKeys (int iScanCode)
+{
+ if (GetKeyState (VK_SHIFT) & 0x8000)
+ return;
+
+ if (iScanCode == KEY_ShiftL && g_winKeyState[KEY_ShiftR])
+ winSendKeyEvent (KEY_ShiftR, FALSE);
+ if (iScanCode == KEY_ShiftR && g_winKeyState[KEY_ShiftL])
+ winSendKeyEvent (KEY_ShiftL, FALSE);
+}