Flush input events before destroying the window

This commit is contained in:
Yuri Roubinsky 2022-01-14 16:45:16 +03:00
parent f60c81af11
commit 9418a2a599

View file

@ -2819,6 +2819,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_DEVICECHANGE: { case WM_DEVICECHANGE: {
joypad->probe_joypads(); joypad->probe_joypads();
} break; } break;
case WM_DESTROY: {
Input::get_singleton()->flush_buffered_events();
} break;
case WM_SETCURSOR: { case WM_SETCURSOR: {
if (LOWORD(lParam) == HTCLIENT) { if (LOWORD(lParam) == HTCLIENT) {
if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) { if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) {