aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winkeybd.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winkeybd.c')
-rw-r--r--xorg-server/hw/xwin/winkeybd.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index 611ea5d55..317f14dff 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -73,10 +73,31 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
{
int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
- int iParamScanCode = LOBYTE (HIWORD (lParam));
+ int iParam = HIWORD (lParam);
+ int iParamScanCode = LOBYTE (iParam);
+
+/* WM_ key messages faked by Vista speech recognition (WSR) don't have a
+ * scan code.
+ *
+ * Vocola 3 (Rick Mohr's supplement to WSR) uses
+ * System.Windows.Forms.SendKeys.SendWait(), which appears always to give a
+ * scan code of 1
+ */
+ if (iParamScanCode <= 1)
+ {
+ if (VK_PRIOR <= wParam && wParam <= VK_DOWN)
+ /* Trigger special case table to translate to extended
+ * keycode, otherwise if num_lock is on, we can get keypad
+ * numbers instead of navigation keys. */
+ iParam |= KF_EXTENDED;
+ else
+ iParamScanCode = MapVirtualKeyEx(wParam,
+ /*MAPVK_VK_TO_VSC*/0,
+ GetKeyboardLayout(0));
+ }
/* Branch on special extended, special non-extended, or normal key */
- if ((HIWORD (lParam) & KF_EXTENDED) && iKeyFixupEx)
+ if ((iParam & KF_EXTENDED) && iKeyFixupEx)
*piScanCode = iKeyFixupEx;
else if (iKeyFixup)
*piScanCode = iKeyFixup;