Fix simultanious presses of Left and Right Control and Shift keys.
https://bugs.freedesktop.org/show_bug.cgi?id=3677
This commit is contained in:
parent
0f2c8221c9
commit
d72fef26d4
|
@ -1,3 +1,11 @@
|
||||||
|
2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
|
||||||
|
|
||||||
|
* winkeybd.c:
|
||||||
|
* winkeybd.h:
|
||||||
|
* winwndproc.c:
|
||||||
|
Fix simultanious presses of Left and Right Control and Shift keys.
|
||||||
|
https://bugs.freedesktop.org/show_bug.cgi?id=3677
|
||||||
|
|
||||||
2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
|
2005-07-05 Alexander Gottwald <ago at freedesktop dot org>
|
||||||
|
|
||||||
* winmultiwindowwm.c:
|
* winmultiwindowwm.c:
|
||||||
|
|
|
@ -612,3 +612,39 @@ winSendKeyEvent (DWORD dwKey, Bool fDown)
|
||||||
xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE;
|
xCurrentEvent.u.u.detail = dwKey + MIN_KEYCODE;
|
||||||
mieqEnqueue (&xCurrentEvent);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ g_iKeyMap [] = {
|
||||||
/* 13 */ VK_RETURN, 0, KEY_KP_Enter,
|
/* 13 */ VK_RETURN, 0, KEY_KP_Enter,
|
||||||
/* 14 */ 0, 0, 0,
|
/* 14 */ 0, 0, 0,
|
||||||
/* 15 */ 0, 0, 0,
|
/* 15 */ 0, 0, 0,
|
||||||
/* 16 */ VK_SHIFT, KEY_ShiftL, KEY_ShiftR,
|
/* 16 */ VK_SHIFT, 0, 0,
|
||||||
/* 17 */ VK_CONTROL, 0, KEY_RCtrl,
|
/* 17 */ VK_CONTROL, 0, KEY_RCtrl,
|
||||||
/* 18 */ VK_MENU, 0, KEY_AltLang,
|
/* 18 */ VK_MENU, 0, KEY_AltLang,
|
||||||
/* 19 */ VK_PAUSE, KEY_Pause, 0,
|
/* 19 */ VK_PAUSE, KEY_Pause, 0,
|
||||||
|
|
|
@ -42,6 +42,12 @@
|
||||||
#include "winconfig.h"
|
#include "winconfig.h"
|
||||||
#include "winmsg.h"
|
#include "winmsg.h"
|
||||||
|
|
||||||
|
#ifdef XKB
|
||||||
|
extern BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
|
||||||
|
#endif
|
||||||
|
extern void winFixShiftKeys (int iScanCode);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
@ -1014,11 +1020,22 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
* Discard presses generated from Windows auto-repeat
|
* Discard presses generated from Windows auto-repeat
|
||||||
* ago: Only discard them if XKB is not disabled
|
* ago: Only discard them if XKB is not disabled
|
||||||
*/
|
*/
|
||||||
if (!g_winInfo.xkb.disable)
|
if (!g_winInfo.xkb.disable && (lParam & (1<<30)))
|
||||||
{
|
{
|
||||||
if (lParam & (1<<30))
|
switch (wParam)
|
||||||
return 0;
|
{
|
||||||
}
|
/* ago: Pressing LControl while RControl is pressed is
|
||||||
|
* Indicated as repeat. Fix this!
|
||||||
|
*/
|
||||||
|
case VK_CONTROL:
|
||||||
|
case VK_SHIFT:
|
||||||
|
if (winCheckKeyPressed(wParam, lParam))
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */
|
/* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */
|
||||||
|
@ -1057,6 +1074,10 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
/* Enqueue a keyup event */
|
/* Enqueue a keyup event */
|
||||||
winTranslateKey (wParam, lParam, &iScanCode);
|
winTranslateKey (wParam, lParam, &iScanCode);
|
||||||
winSendKeyEvent (iScanCode, FALSE);
|
winSendKeyEvent (iScanCode, FALSE);
|
||||||
|
|
||||||
|
/* Release all pressed shift keys */
|
||||||
|
if (wParam == VK_SHIFT)
|
||||||
|
winFixShiftKeys (iScanCode);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_HOTKEY:
|
case WM_HOTKEY:
|
||||||
|
|
Loading…
Reference in New Issue