[PATCH v3 0/2] MR11315: Patches for bugs 3638 and 40736
The new `winevdm.c` patches the PIF bug as described in [issue 3638 ](https://bugs.winehq.org/show_bug.cgi?id=3638)on Bugzilla. Meanwhile, a patch for `keyboard.c` resolves [bug 40736](https://bugs.winehq.org/show_bug.cgi?id=40736) by suppressing input of the <kbd>+</kbd>, <kbd>-</kbd>, and <kbd>\*</kbd> keys on the numpad when pressed with <kbd>Ctrl</kbd> held down. Both patches were successfully tested as reported in the respective forums. -- v3: Edit keyboard.c so that update_lock_state() clears https://gitlab.winehq.org/wine/wine/-/merge_requests/11315
From: Big Blue Gnu <imccluney@comcast.net> - /programs/winevdm/winevdm.c - /dlls/winex11.drv/keyboard.c --- dlls/winex11.drv/keyboard.c | 5 ++++- programs/winevdm/winevdm.c | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 668a25b1345..c998ef6cce5 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -2986,7 +2986,10 @@ INT X11DRV_ToUnicodeEx( UINT virtKey, UINT scanCode, const BYTE *lpKeyState, { if (((keysym>=33) && (keysym < '@')) || (keysym == '`') || - (keysym == XK_Tab)) + (keysym == XK_Tab)) || + (keysym == XK_KP_Add) || + (keysym == XK_KP_Subtract) || + (keysym == XK_KP_Multiply) { lpChar[0] = 0; ret = 0; diff --git a/programs/winevdm/winevdm.c b/programs/winevdm/winevdm.c index f51e7cc9ca9..fda69367643 100644 --- a/programs/winevdm/winevdm.c +++ b/programs/winevdm/winevdm.c @@ -289,7 +289,7 @@ static VOID pif_cmd( char *filename, char *cmdline) MessageBoxA( NULL, buf, "16 bit DOS subsystem", MB_OK|MB_ICONWARNING); } /* search for the program */ - if( !SearchPathA( NULL, progname, NULL, MAX_PATH, progpath, NULL )) { + if( !SearchPathA( NULL, filename, NULL, MAX_PATH, progpath, NULL )) { sprintf( buf, "%s\nInvalid program file name. Check your pif file.", filename); MessageBoxA( NULL, buf, "16 bit DOS subsystem", MB_OK|MB_ICONERROR); @@ -302,6 +302,13 @@ static VOID pif_cmd( char *filename, char *cmdline) /* if no arguments on the commandline, use them from the pif file */ if( !cmdline[0] && optparams[0]) cmdline = optparams; + if( (p = strrchr( progpath, '\\'))) + *p = '\0'; + if( !(p = strrchr( progname, '\\'))) { + memmove( progname + 1, progname, strlen(progname) + 1); + progname[0] = '\\'; + } + strcat( progpath, p ? p : progname); /* FIXME: do something with: * - close on exit * - graphic modes -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11315
From: "Iain S. McCluney" <imccluney@comcast.net> --- dlls/winex11.drv/keyboard.c | 66 +++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index c998ef6cce5..f26291b52d5 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1478,31 +1478,61 @@ static void update_lock_state( HWND hwnd, WORD vkey, UINT state, UINT time ) if (!NtUserGetAsyncKeyboardState( keystate )) return; - /* Adjust the CAPSLOCK state if it has been changed outside wine */ - if (!(keystate[VK_CAPITAL] & 0x01) != !(state & LockMask) && vkey != VK_CAPITAL) + if (vkey != VK_CAPITAL) { - DWORD flags = 0; - if (keystate[VK_CAPITAL] & 0x80) flags ^= KEYEVENTF_KEYUP; - TRACE("Adjusting CapsLock state (%#.2x)\n", keystate[VK_CAPITAL]); - adjust_lock_state( keystate, hwnd, VK_CAPITAL, 0x3a, flags, time ); + /* Clear stale CAPSLOCK down */ + if (!!(keystate[VK_CAPITAL] & 0x01) == !!(state & LockMask) && keystate[VK_CAPITAL] & 0x80) + { + TRACE("Clearing stale CapsLock down (%#.2x)\n", keystate[VK_CAPITAL]); + keystate[VK_CAPITAL] &= ~0x80; + set_async_key_state( keystate ); + } + /* Adjust the CAPSLOCK state if it has been changed outside wine */ + else if (!(keystate[VK_CAPITAL] & 0x01) != !(state & LockMask)) + { + DWORD flags = 0; + if (keystate[VK_CAPITAL] & 0x80) flags ^= KEYEVENTF_KEYUP; + TRACE("Adjusting CapsLock state (%#.2x)\n", keystate[VK_CAPITAL]); + adjust_lock_state( keystate, hwnd, VK_CAPITAL, 0x3a, flags, time ); + } } - /* Adjust the NUMLOCK state if it has been changed outside wine */ - if (!(keystate[VK_NUMLOCK] & 0x01) != !(state & NumLockMask) && (vkey & 0xff) != VK_NUMLOCK) + if ((vkey & 0xff) != VK_NUMLOCK) { - DWORD flags = KEYEVENTF_EXTENDEDKEY; - if (keystate[VK_NUMLOCK] & 0x80) flags ^= KEYEVENTF_KEYUP; - TRACE("Adjusting NumLock state (%#.2x)\n", keystate[VK_NUMLOCK]); - adjust_lock_state( keystate, hwnd, VK_NUMLOCK, 0x45, flags, time ); + /* Clear stale NUMLOCK down */ + if (!!(keystate[VK_NUMLOCK] & 0x01) == !!(state & NumLockMask) && keystate[VK_NUMLOCK] & 0x80) + { + TRACE("Clearing stale NumLock down (%#.2x)\n", keystate[VK_NUMLOCK]); + keystate[VK_NUMLOCK] &= ~0x80; + set_async_key_state( keystate ); + } + /* Adjust the NUMLOCK state if it has been changed outside wine */ + else if (!(keystate[VK_NUMLOCK] & 0x01) != !(state & NumLockMask)) + { + DWORD flags = KEYEVENTF_EXTENDEDKEY; + if (keystate[VK_NUMLOCK] & 0x80) flags ^= KEYEVENTF_KEYUP; + TRACE("Adjusting NumLock state (%#.2x)\n", keystate[VK_NUMLOCK]); + adjust_lock_state( keystate, hwnd, VK_NUMLOCK, 0x45, flags, time ); + } } - /* Adjust the SCROLLLOCK state if it has been changed outside wine */ - if (!(keystate[VK_SCROLL] & 0x01) != !(state & ScrollLockMask) && vkey != VK_SCROLL) + if (vkey != VK_SCROLL) { - DWORD flags = 0; - if (keystate[VK_SCROLL] & 0x80) flags ^= KEYEVENTF_KEYUP; - TRACE("Adjusting ScrLock state (%#.2x)\n", keystate[VK_SCROLL]); - adjust_lock_state( keystate, hwnd, VK_SCROLL, 0x46, flags, time ); + /* Clear stale SCROLLLOCK down */ + if (!!(keystate[VK_SCROLL] & 0x01) == !!(state & ScrollLockMask) && keystate[VK_SCROLL] & 0x80) + { + TRACE("Clearing stale ScrLock down (%#.2x)\n", keystate[VK_SCROLL]); + keystate[VK_SCROLL] &= ~0x80; + set_async_key_state( keystate ); + } + /* Adjust the SCROLLLOCK state if it has been changed outside wine */ + else if (!(keystate[VK_SCROLL] & 0x01) != !(state & ScrollLockMask)) + { + DWORD flags = 0; + if (keystate[VK_SCROLL] & 0x80) flags ^= KEYEVENTF_KEYUP; + TRACE("Adjusting ScrLock state (%#.2x)\n", keystate[VK_SCROLL]); + adjust_lock_state( keystate, hwnd, VK_SCROLL, 0x46, flags, time ); + } } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11315
participants (3)
-
Big Blue Gnu -
Iain S. McCluney -
Iain S. McCluney (@BigBlueGnu)