This is the mail archive of the
cygwin-xfree
mailing list for the Cygwin XFree86 project.
[PATCHES] Re: keypad assignments
- From: Paul Loewenstein <paul dot loewenstein at gmail dot com>
- To: Paul Loewenstein <Paul dot Loewenstein at gmail dot com>
- Cc: cygwin-xfree at cygwin dot com
- Date: Tue, 31 Mar 2009 22:31:30 -0700
- Subject: [PATCHES] Re: keypad assignments
- References: <200903251016.n2PAGbqU018742@mail.bln1.bf.nsn-intra.net> <49D13BB8.2050308@gmail.com>
- Reply-to: cygwin-xfree at cygwin dot com
To Cygwin maintainers:
Attached are two unidiff files for correcting the problem of translating
numeric keypad navigation keys to editing keypad navigation keys.
Editing keypad navigation is now only forced in the absence of a scancode.
Paul
Paul Loewenstein wrote:
Thomas,
I believe I have fixed the problem. What program do you use for
displaying the keycodes so I can test the fix before sending in the
patch?
Paul
Thomas Wolff wrote:
Hello,
I've managed to re-activate my Cygwin/XFree (there had been this
disabled keyboard problem with a non-cygwin XKEYSYMDB variable
setting since some recent release...).
So I discovered that, assumedly with that recent major revision, a
keyboard handling deficiency has been introduced:
The keys of the right keypad (aka "numeric keypad") do no longer emit
the keysyms KP_Home, KP_Up etc as they used to do but just plainly
Home, Up etc which are also the keysyms of the small keypad (aka
"editing keypad"). This makes them indistinguishable for any
application - even worse, this cannot be fixed by configuration since
they even send the same keycodes!
These are different keys - considering them as aliases is a waste of
physical resources - and they must be distinguishable for an
application.
That means, they must have different keycodes and they should also
have different keysyms by default - that's what the KP_ keysyms are
designed for.
Thanks and kind regards,
Thomas
--
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/
--- ./origsrc/xorg-server-1.5.3/hw/xwin/winkeybd.c 2009-03-28 12:49:22.113013400 -0700
+++ ./src/xorg-server-1.5.3/hw/xwin/winkeybd.c 2009-03-31 21:39:23.908709800 -0700
@@ -78,7 +78,8 @@
{
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.
@@ -89,13 +90,19 @@
*/
if (iParamScanCode <= 1)
{
- iParamScanCode = MapVirtualKeyEx(wParam,
- /*MAPVK_VK_TO_VSC*/0,
- GetKeyboardLayout(0));
+ 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;
--- ./origsrc/xorg-server-1.5.3/hw/xwin/winkeybd.h 2009-03-28 12:49:22.113013400 -0700
+++ ./src/xorg-server-1.5.3/hw/xwin/winkeybd.h 2009-03-31 21:41:47.959509800 -0700
@@ -45,10 +45,8 @@
#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
+/* Rows 160 through 165 correspond to software-generated codes, which
+ * may not be associated with the appropriate scan code.
*/
const int
g_iKeyMap [] = {
@@ -86,14 +84,14 @@
/* 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,
+ /* 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,
@@ -213,12 +211,12 @@
/* 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,
+ /* 160 */ VK_LSHIFT, KEY_ShiftL, 0,
+ /* 161 */ VK_RSHIFT, KEY_ShiftR, 0,
+ /* 162 */ VK_LCONTROL, KEY_LCtrl, 0,
+ /* 163 */ VK_RCONTROL, KEY_RCtrl, 0,
+ /* 164 */ VK_LMENU, KEY_Alt, 0,
+ /* 165 */ VK_RMENU, KEY_AltLang, 0,
/* 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/