Allow ToAscii/ToUnicode work with scanCode = 0
Dmitry Timoshkov
dmitry at baikal.ru
Sat Feb 9 09:57:33 CST 2002
Hello.
This is almost the same patch, which was posted to a news group,
but with added TRACE's. It solves a problem with Lightwave, which
does GetKeyboardState() + ToAscii(VK_?, 0, ...) on each WM_KEYDOWN
message. Current code just ignores calls to ToAscii/ToUnicode if
scanCode is 0. I'm not sure, but probably we should add a check
for VK_MENU in lpKeyState and return 0 in that case?
Patch also removes computing of AltGrMask, since we save and restore
it on each key press event in any case.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
Allow ToAscii/ToUnicode work with scanCode = 0.
--- cvs/hq/wine/windows/x11drv/keyboard.c Sat Nov 24 17:54:14 2001
+++ wine/windows/x11drv/keyboard.c Sat Feb 9 20:41:26 2002
@@ -997,12 +997,7 @@
int k;
for (k = 0; k < keysyms_per_keycode; k += 1)
- if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Mode_switch)
- {
- AltGrMask = 1 << i;
- TRACE_(key)("AltGrMask is %x\n", AltGrMask);
- }
- else if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock)
+ if (TSXKeycodeToKeysym(display, *kcp, k) == XK_Num_Lock)
{
NumLockMask = 1 << i;
TRACE_(key)("NumLockMask is %x\n", NumLockMask);
@@ -1506,12 +1501,6 @@
int keyc;
BYTE lpChar[2];
- if (scanCode==0) {
- /* This happens when doing Alt+letter : a fake 'down arrow' key press
- event is generated by windows. Just ignore it. */
- TRACE("scanCode=0, doing nothing\n");
- return 0;
- }
if (scanCode & 0x8000)
{
TRACE("Key UP, doing nothing\n" );
@@ -1521,15 +1510,28 @@
e.keycode = 0;
e.state = 0;
if (lpKeyState[VK_SHIFT] & 0x80)
+ {
+ TRACE("ShiftMask = %04x\n", ShiftMask);
e.state |= ShiftMask;
+ }
if (lpKeyState[VK_CAPITAL] & 0x01)
+ {
+ TRACE("LockMask = %04x\n", LockMask);
e.state |= LockMask;
+ }
if (lpKeyState[VK_CONTROL] & 0x80)
+ {
+ TRACE("ControlMask = %04x\n", ControlMask);
e.state |= ControlMask;
+ }
if (lpKeyState[VK_NUMLOCK] & 0x01)
+ {
+ TRACE("NumLockMask = %04x\n", NumLockMask);
e.state |= NumLockMask;
+ }
/* Restore saved AltGr state */
+ TRACE("AltGrMask = %04x\n", AltGrMask);
e.state |= AltGrMask;
TRACE_(key)("(%04X, %04X) : faked state = %X\n",
More information about the wine-patches
mailing list