aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winkeybd.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-07-25 08:32:37 +0200
committermarha <marha@users.sourceforge.net>2013-07-25 08:32:37 +0200
commitacf3535c75d7c79154b6b89c66567317944d244c (patch)
tree8fcc57fc152d9c594e3119678a6f5d8f0160267b /xorg-server/hw/xwin/winkeybd.c
parent5c340ceb9356ea029dea53b73440268d4769d5a5 (diff)
downloadvcxsrv-acf3535c75d7c79154b6b89c66567317944d244c.tar.gz
vcxsrv-acf3535c75d7c79154b6b89c66567317944d244c.tar.bz2
vcxsrv-acf3535c75d7c79154b6b89c66567317944d244c.zip
xserver mesa git update 25 Jul 2013
xserver commit 43ac0491e36cdbb716b5c9d39c97d0aba3bebd75 mesa commit 8a9df7a370b66ec50b6255e4d66ac1ed331319fb
Diffstat (limited to 'xorg-server/hw/xwin/winkeybd.c')
-rw-r--r--xorg-server/hw/xwin/winkeybd.c62
1 files changed, 42 insertions, 20 deletions
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index e412f2355..9c5d4e9cd 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -65,13 +65,14 @@ static void
* like AltGr on European keyboards.
*/
-void
-winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
+int
+winTranslateKey(WPARAM wParam, LPARAM lParam)
{
int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
int iParam = HIWORD(lParam);
int iParamScanCode = LOBYTE(iParam);
+ int iScanCode;
winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
@@ -96,23 +97,25 @@ winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
/* Branch on special extended, special non-extended, or normal key */
if ((iParam & KF_EXTENDED) && iKeyFixupEx)
- *piScanCode = iKeyFixupEx;
+ iScanCode = iKeyFixupEx;
else if (iKeyFixup)
- *piScanCode = iKeyFixup;
+ iScanCode = iKeyFixup;
else if (wParam == 0 && iParamScanCode == 0x70)
- *piScanCode = KEY_HKTG;
+ iScanCode = KEY_HKTG;
else
switch (iParamScanCode) {
case 0x70:
- *piScanCode = KEY_HKTG;
+ iScanCode = KEY_HKTG;
break;
case 0x73:
- *piScanCode = KEY_BSlash2;
+ iScanCode = KEY_BSlash2;
break;
default:
- *piScanCode = iParamScanCode;
+ iScanCode = iParamScanCode;
break;
}
+
+ return iScanCode;
}
/* Ring the keyboard bell (system speaker on PCs) */
@@ -264,25 +267,38 @@ winRestoreModeKeyStates(void)
/* Check if modifier keys are pressed, and if so, fake a press */
{
- BOOL ctrl = (GetAsyncKeyState(VK_CONTROL) < 0);
- BOOL shift = (GetAsyncKeyState(VK_SHIFT) < 0);
+
+ BOOL lctrl = (GetAsyncKeyState(VK_LCONTROL) < 0);
+ BOOL rctrl = (GetAsyncKeyState(VK_RCONTROL) < 0);
+ BOOL lshift = (GetAsyncKeyState(VK_LSHIFT) < 0);
+ BOOL rshift = (GetAsyncKeyState(VK_RSHIFT) < 0);
BOOL alt = (GetAsyncKeyState(VK_LMENU) < 0);
BOOL altgr = (GetAsyncKeyState(VK_RMENU) < 0);
- if (ctrl && altgr)
- ctrl = FALSE;
+ /*
+ If AltGr and CtrlL appear to be pressed, assume the
+ CtrL is a fake one
+ */
+ if (lctrl && altgr)
+ lctrl = FALSE;
+
+ if (lctrl)
+ winSendKeyEvent(KEY_LCtrl, TRUE);
- if (LOGICAL_XOR(internalKeyStates & ControlMask, ctrl))
- winSendKeyEvent(KEY_LCtrl, ctrl);
+ if (rctrl)
+ winSendKeyEvent(KEY_RCtrl, TRUE);
- if (LOGICAL_XOR(internalKeyStates & ShiftMask, shift))
- winSendKeyEvent(KEY_ShiftL, shift);
+ if (lshift)
+ winSendKeyEvent(KEY_ShiftL, TRUE);
- if (LOGICAL_XOR(internalKeyStates & Mod1Mask, alt))
- winSendKeyEvent(KEY_Alt, alt);
+ if (rshift)
+ winSendKeyEvent(KEY_ShiftL, TRUE);
- if (LOGICAL_XOR(internalKeyStates & Mod5Mask, altgr))
- winSendKeyEvent(KEY_AltLang, altgr);
+ if (alt)
+ winSendKeyEvent(KEY_Alt, TRUE);
+
+ if (altgr)
+ winSendKeyEvent(KEY_AltLang, TRUE);
}
/*
@@ -313,6 +329,12 @@ winRestoreModeKeyStates(void)
winSendKeyEvent(KEY_HKTG, TRUE);
winSendKeyEvent(KEY_HKTG, FALSE);
}
+
+ /*
+ For strict correctness, we should also press any non-modifier keys
+ which are already down when we gain focus, but nobody has complained
+ yet :-)
+ */
}
/*