diff --git a/core/os/os.h b/core/os/os.h index d6541034fd..30cfb32b89 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -518,6 +518,7 @@ public: bool is_restart_on_exit_set() const; List get_restart_on_exit_arguments() const; + virtual void process_and_drop_events() { } OS(); virtual ~OS(); }; diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 3ed25f118d..e7ff7a3aef 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -311,6 +311,7 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) } else { OS::get_singleton()->delay_usec(10000); + OS::get_singleton()->process_and_drop_events(); } } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 61aeb3ec93..a213e495b4 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -298,6 +298,17 @@ void OS_Windows::_drag_event(float p_x, float p_y, int idx) { LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + if (drop_events) { + + if (user_proc) { + + return CallWindowProcW(user_proc, hWnd, uMsg, wParam, lParam); + } else { + return DefWindowProcW(hWnd, uMsg, wParam, lParam); + } + }; + + switch (uMsg) // Check For Windows Messages { case WM_SETFOCUS: { @@ -2230,7 +2241,9 @@ void OS_Windows::process_events() { MSG msg; - joypad->process_joypads(); + if (!drop_events) { + joypad->process_joypads(); + } while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) { @@ -2238,7 +2251,9 @@ void OS_Windows::process_events() { DispatchMessageW(&msg); } - process_key_events(); + if (!drop_events) { + process_key_events(); + } } void OS_Windows::set_cursor_shape(CursorShape p_shape) { @@ -2987,6 +3002,13 @@ bool OS_Windows::is_disable_crash_handler() const { return crash_handler.is_disabled(); } +void OS_Windows::process_and_drop_events() { + + drop_events=true; + process_events(); + drop_events=false; +} + Error OS_Windows::move_to_trash(const String &p_path) { SHFILEOPSTRUCTW sf; WCHAR *from = new WCHAR[p_path.length() + 2]; @@ -3015,6 +3037,7 @@ Error OS_Windows::move_to_trash(const String &p_path) { OS_Windows::OS_Windows(HINSTANCE _hInstance) { + drop_events = false; key_event_pos = 0; layered_window = false; hBitmap = NULL; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 6c257016ec..2d03532c69 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -127,6 +127,7 @@ class OS_Windows : public OS { bool window_has_focus; uint32_t last_button_state; bool use_raw_input; + bool drop_events; HCURSOR cursors[CURSOR_MAX] = { NULL }; CursorShape cursor_shape; @@ -330,6 +331,8 @@ public: virtual Error move_to_trash(const String &p_path); + virtual void process_and_drop_events(); + OS_Windows(HINSTANCE _hInstance); ~OS_Windows(); };