This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
Re: [patch 4/7] Cygwin/X: Invent a scan code if we dont have one
Jon,
Sorry, I did the diff backwards. You can tell I don't do this often.
Corrected .diffs attached, so you don't have to use the patch reverse
option.
Paul
Paul Loewenstein wrote:
Jon,
Attached are my final patches. MAPVK_VK_TO_VSC_EX (which is 4, not 3)
did not help with the numeric-keypad key/num-lock problem. I have
fixed that problem with an update to the special case table in
winkeybd.h. I have also added to that table the (generated by
software only) codes for left/right-specific shift/control/alt. I
have not tested the left/right-specific entries. You may want to
check that I have put the correct codes in the correct rows (that
correspond to the codes).
Paul
Paul Loewenstein wrote:
I plan to do a reasonably thorough investigation of what scan codes
show up during speech recognition. I believe I have seen both 0 and
1 (the ESC scancode). The latter must be a bug (almost certainly
Microsoft's) rather than a mere omission, but is much simpler to work
around than to get fixed. I believe it is safe to regenerate the
scancode for ESC, for all keyboards, even if the scancode is provided.
Have you looked at using| MAPVK_VK_TO_VSC_EX |(3) instead of
MAPVK_VK_TO_VSC(0)? This may solve the numeric keypad/numlock
problem described below. The code then has to look at the HIBYTE of
the regenerated iParamScanCode to check for E0, the extended key
scancode, and set KF_EXTENDED bit in HIWORD (lParam) if E0, then
clear HIBYTE (iParamScanCode).
When num-lock is asserted; with my tentative fix (using
MAPVK_VK_TO_VSC) saying "move to end of line" generates "1".
However, saying "press end" generates a fake "end" key correctly, I
would guess by enclosing the simulated key with simulated num-lock
keystrokes.
Another valid way of dealing with these keys in the absence of a scan
code is to generate an extended key code (i.e. for the keys between
the numeric keypad and the alphabetic keys).
To resolve some of the above guesswork, I need to quickly hack an
application that displays both the virtual key code and the scan
code, together with the extended key indication. I should be able to
do that with a quick modification to publicly available code. I can
also modify it to test |MAPVK_VK_TO_VSC_EX|, which may solve the
numeric keypad scancode problem problem cleanly by providing extended
keycodes instead.
I would prefer to perform a clean, single fix. I'll also use diff!!
Paul
Reini Urban wrote:
Shouldn't we properly attribute Paul Loewenstein at least in the
patch who came up with this idea.
Jon TURNEY wrote:
Reini Urban wrote:
Shouldn't we properly attribute Paul Loewenstein at least in the
patch who came up with this idea.
Indeed, thanks for pointing out this oversight.
Revised patch attached.
That's what happens to people who don't use diff :-)
------------------------------------------------------------------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
------------------------------------------------------------------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/
*** /usr/src/xorg-server-1.5.3-4/src/xorg-server-1.5.3/hw/xwin/winkeybd.c Sat Jan 17 13:17:33 2009
--- xwin/xorg-server-1.5.3-4/src/xorg-server-1.5.3/hw/xwin/winkeybd.c Sat Jan 17 15:02:21 2009
***************
*** 80,85 ****
--- 80,99 ----
int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
int iParamScanCode = LOBYTE (HIWORD (lParam));
+ /* WM_ key messages faked by Vista speech recognition (WSR) don't have a
+ * scan code.
+ *
+ * Vocola 3 (a supplement to WSR) uses
+ * System.Windows.Forms.SendKeys.SendWait(), which appears to always
+ * give a scan code of 1
+ */
+ if (iParamScanCode <= 1)
+ {
+ 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)
*piScanCode = iKeyFixupEx;
*** /usr/src/xorg-server-1.5.3-4/src/xorg-server-1.5.3/hw/xwin/winkeybd.h Tue Oct 23 14:26:52 2007
--- xwin/xorg-server-1.5.3-4/src/xorg-server-1.5.3/hw/xwin/winkeybd.h Sat Jan 17 12:46:15 2009
***************
*** 45,50 ****
--- 45,55 ----
#define WIN_KEYMAP_COLS 3
+ /* ASCII column, rows 33 through 40 are for Speech Recognition with
+ * num-lock asserted.
+ * Rows 160 through 165 correspond to software-generated codes, which
+ * may not be associated with the appropriate scan code/extended bit
+ */
const int
g_iKeyMap [] = {
/* count Windows VK, ASCII, ASCII when extended VK */
***************
*** 81,94 ****
/* 30 */ 0, 0, 0,
/* 31 */ 0, 0, 0,
/* 32 */ 0, 0, 0,
! /* 33 */ VK_PRIOR, 0, KEY_PgUp,
! /* 34 */ VK_NEXT, 0, KEY_PgDown,
! /* 35 */ VK_END, 0, KEY_End,
! /* 36 */ VK_HOME, 0, KEY_Home,
! /* 37 */ VK_LEFT, 0, KEY_Left,
! /* 38 */ VK_UP, 0, KEY_Up,
! /* 39 */ VK_RIGHT, 0, KEY_Right,
! /* 40 */ VK_DOWN, 0, KEY_Down,
/* 41 */ 0, 0, 0,
/* 42 */ 0, 0, 0,
/* 43 */ 0, 0, 0,
--- 86,99 ----
/* 30 */ 0, 0, 0,
/* 31 */ 0, 0, 0,
/* 32 */ 0, 0, 0,
! /* 33 */ VK_PRIOR, KEY_PgUp, KEY_PgUp,
! /* 34 */ VK_NEXT, KEY_PgDown, KEY_PgDown,
! /* 35 */ VK_END, KEY_End, KEY_End,
! /* 36 */ VK_HOME, KEY_Home, KEY_Home,
! /* 37 */ VK_LEFT, KEY_Left, KEY_Left,
! /* 38 */ VK_UP, KEY_Up, KEY_Up,
! /* 39 */ VK_RIGHT, KEY_Right, KEY_Right,
! /* 40 */ VK_DOWN, KEY_Down, KEY_Down,
/* 41 */ 0, 0, 0,
/* 42 */ 0, 0, 0,
/* 43 */ 0, 0, 0,
***************
*** 208,219 ****
/* 157 */ 0, 0, 0,
/* 158 */ 0, 0, 0,
/* 159 */ 0, 0, 0,
! /* 160 */ 0, 0, 0,
! /* 161 */ 0, 0, 0,
! /* 162 */ 0, 0, 0,
! /* 163 */ 0, 0, 0,
! /* 164 */ 0, 0, 0,
! /* 165 */ 0, 0, 0,
/* 166 */ 0, 0, 0,
/* 167 */ 0, 0, 0,
/* 168 */ 0, 0, 0,
--- 213,224 ----
/* 157 */ 0, 0, 0,
/* 158 */ 0, 0, 0,
/* 159 */ 0, 0, 0,
! /* 160 */ VK_LSHIFT, KEY_ShiftL, KEY_ShiftL,
! /* 161 */ VK_RSHIFT, KEY_ShiftR, KEY_ShiftR,
! /* 162 */ VK_LCONTROL, KEY_LCtrl, KEY_LCtrl,
! /* 163 */ VK_RCONTROL, KEY_RCtrl, KEY_RCtrl,
! /* 164 */ VK_LMENU, KEY_Alt, KEY_Alt,
! /* 165 */ VK_RMENU, KEY_AltLang, KEY_AltLang,
/* 166 */ 0, 0, 0,
/* 167 */ 0, 0, 0,
/* 168 */ 0, 0, 0,
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ: http://x.cygwin.com/docs/faq/