x11drv: (bug 4685) some ALT+key combos processed incorrectly
tkho at ucla.edu
tkho at ucla.edu
Tue Mar 21 16:49:53 CST 2006
Patch to recognize VK_LMENU and VK_RMENU in alt-key combos (bug 4685)
This patch looks for VK_LMENU and VK_RMENU in addition to VK_MENU when dealing
with ALT-key combo messages. This is the easiest way to add this functionality,
but arguably not the cleanest.
2006-03-21 Thomas Kho <tkho at ucla.edu>
* dlls/x11drv/keyboard.c
x11drv: recognize VK_LMENU and VK_RMENU in ALT-key combos
Signed-off-by: Thomas Kho <tkho at ucla.edu>
Index: dlls/x11drv/keyboard.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/keyboard.c,v
retrieving revision 1.85
diff -u -r1.85 keyboard.c
--- dlls/x11drv/keyboard.c 9 Feb 2006 11:50:16 -0000 1.85
+++ dlls/x11drv/keyboard.c 15 Mar 2006 00:20:21 -0000
@@ -83,9 +83,6 @@
*/
BYTE key_state_table[256];
-static BYTE TrackSysKey = 0; /* determine whether ALT key up will cause a WM_SYSKEYUP
- or a WM_KEYUP message */
-
static int min_keycode, max_keycode, keysyms_per_keycode;
static WORD keyc2vkey[256], keyc2scan[256];
@@ -1112,6 +1109,8 @@
UINT message;
KEYLP keylp;
KBDLLHOOKSTRUCT hook;
+ static BYTE TrackSysKey = 0; /* determine whether ALT key up will cause a
+ WM_SYSKEYUP or a WM_KEYUP message */
keylp.lp2 = 0;
keylp.lp1.count = 1;
@@ -1126,11 +1125,15 @@
if (dwFlags & KEYEVENTF_KEYUP )
{
message = WM_KEYUP;
- if ((key_state_table[VK_MENU] & 0x80) &&
- ((wVk == VK_MENU) || (wVk == VK_CONTROL) || !(key_state_table[VK_CONTROL] & 0x80)))
+ if ((key_state_table[VK_MENU] & 0x80 || key_state_table[VK_LMENU] & 0x80
+ || key_state_table[VK_RMENU] & 0x80)
+ && (wVk == VK_MENU || wVk == VK_LMENU || wVk == VK_RMENU
+ || wVk == VK_CONTROL || !(key_state_table[VK_CONTROL] & 0x80)))
{
- if( TrackSysKey == VK_MENU || /* <ALT>-down/<ALT>-up sequence */
- (wVk != VK_MENU)) /* <ALT>-down...<something else>-up */
+ if ((TrackSysKey == VK_MENU || TrackSysKey == VK_LMENU
+ || TrackSysKey == VK_RMENU) /* <ALT>-down/<ALT>-up sequence */
+ || (wVk != VK_MENU && wVk != VK_LMENU
+ && wVk != VK_RMENU)) /* <ALT>-down...<something else>-up */
message = WM_SYSKEYUP;
TrackSysKey = 0;
}
@@ -1146,14 +1149,18 @@
key_state_table[wVk] |= 0xc0;
message = WM_KEYDOWN;
- if ((key_state_table[VK_MENU] & 0x80) && !(key_state_table[VK_CONTROL] & 0x80))
+ if ((key_state_table[VK_MENU] & 0x80 || key_state_table[VK_LMENU] & 0x80
+ || key_state_table[VK_RMENU] & 0x80)
+ && !(key_state_table[VK_CONTROL] & 0x80))
{
message = WM_SYSKEYDOWN;
TrackSysKey = wVk;
}
}
- keylp.lp1.context = (key_state_table[VK_MENU] & 0x80) != 0; /* 1 if alt */
+ keylp.lp1.context = (key_state_table[VK_MENU] & 0x80
+ || key_state_table[VK_LMENU] & 0x80
+ || key_state_table[VK_RMENU] & 0x80) != 0; /* 1 if alt */
TRACE_(key)(" wParam=%04x, lParam=%08lx, InputKeyState=%x\n",
wVk, keylp.lp2, key_state_table[wVk] );
More information about the wine-patches
mailing list