diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2020-12-11 17:28:46 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2021-01-01 18:09:34 +0300 |
commit | 41efbf8cae6aae1f91cbc2d21049fe53ed4432c6 (patch) | |
tree | 7329a787677773ed94437f64720a378d8534b072 /platform/windows/display_server_windows.cpp | |
parent | 32c06dfc8dbf4c3e29232b7dbccc6a34ba257027 (diff) |
Fixed warning at project startup (WIN32)
Diffstat (limited to 'platform/windows/display_server_windows.cpp')
-rw-r--r-- | platform/windows/display_server_windows.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 62fcd20f61..7f12d307d1 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -1875,27 +1875,12 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA break; } - case WM_ACTIVATE: // Watch For Window Activate Message - { - windows[window_id].minimized = HIWORD(wParam) != 0; - - if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) { - _send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_IN); - windows[window_id].window_focused = true; - alt_mem = false; - control_mem = false; - shift_mem = false; - } else { // WM_INACTIVE - Input::get_singleton()->release_pressed_events(); - _send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_OUT); - windows[window_id].window_focused = false; - alt_mem = false; - }; - - if ((OS::get_singleton()->get_current_tablet_driver() == "wintab") && wintab_available && windows[window_id].wtctx) { - wintab_WTEnable(windows[window_id].wtctx, GET_WM_ACTIVATE_STATE(wParam, lParam)); - } + case WM_ACTIVATE: { // Watch For Window Activate Message + saved_wparam = wParam; + saved_lparam = lParam; + // Run a timer to prevent event catching warning if the window is closing. + focus_timer_id = SetTimer(windows[window_id].hWnd, 2, USER_TIMER_MINIMUM, (TIMERPROC) nullptr); return 0; // Return To The Message Loop } case WM_GETMINMAXINFO: { @@ -1936,6 +1921,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA case WM_CLOSE: // Did We Receive A Close Message? { + if (focus_timer_id != 0U) { + KillTimer(windows[window_id].hWnd, focus_timer_id); + } _send_window_event(windows[window_id], WINDOW_EVENT_CLOSE_REQUEST); return 0; // Jump Back @@ -2629,6 +2617,28 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA if (!Main::is_iterating()) { Main::iteration(); } + } else if (wParam == focus_timer_id) { + windows[window_id].minimized = HIWORD(saved_wparam) != 0; + + if (LOWORD(saved_wparam) == WA_ACTIVE || LOWORD(saved_wparam) == WA_CLICKACTIVE) { + _send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_IN); + windows[window_id].window_focused = true; + alt_mem = false; + control_mem = false; + shift_mem = false; + } else { // WM_INACTIVE + Input::get_singleton()->release_pressed_events(); + _send_window_event(windows[window_id], WINDOW_EVENT_FOCUS_OUT); + windows[window_id].window_focused = false; + alt_mem = false; + }; + + if ((OS::get_singleton()->get_current_tablet_driver() == "wintab") && wintab_available && windows[window_id].wtctx) { + wintab_WTEnable(windows[window_id].wtctx, GET_WM_ACTIVATE_STATE(saved_wparam, saved_lparam)); + } + + KillTimer(windows[window_id].hWnd, focus_timer_id); + focus_timer_id = 0U; } } break; @@ -3209,8 +3219,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win } #endif - move_timer_id = 1; - //set_ime_active(false); if (!OS::get_singleton()->is_in_low_processor_usage_mode()) { |