mirror of https://github.com/OpenTTD/OpenTTD
Fix #8930: [Win32] Don't handle printable keys on keydown if an edit box is in focus.
Handle printable input only when the matching WM_CHAR message is incoming. Without an edit box, do the handling in keydown as usual to support hotkeys.pull/8985/head
parent
785e42a6f9
commit
96d33ab46a
|
@ -552,14 +552,6 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
uint scancode = GB(lParam, 16, 8);
|
||||
keycode = scancode == 41 ? (uint)WKC_BACKQUOTE : MapWindowsKey(wParam);
|
||||
|
||||
/* Silently drop all messages handled by WM_CHAR. */
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE)) {
|
||||
if ((msg.message == WM_CHAR || msg.message == WM_DEADCHAR) && GB(lParam, 16, 8) == GB(msg.lParam, 16, 8)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint charcode = MapVirtualKey(wParam, MAPVK_VK_TO_CHAR);
|
||||
|
||||
/* No character translation? */
|
||||
|
@ -568,6 +560,8 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* If an edit box is in focus, wait for the corresponding WM_CHAR message. */
|
||||
if (!EditBoxInGlobalFocus()) {
|
||||
/* Is the console key a dead key? If yes, ignore the first key down event. */
|
||||
if (HasBit(charcode, 31) && !console) {
|
||||
if (scancode == 41) {
|
||||
|
@ -585,6 +579,9 @@ LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
return HandleCharMsg(cur_keycode, LOWORD(charcode));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_SYSKEYDOWN: // user presses F10 or Alt, both activating the title-menu
|
||||
switch (wParam) {
|
||||
case VK_RETURN:
|
||||
|
|
Loading…
Reference in New Issue