Ability to keep pumping messages while being debugged, may be a solution for #21431

This commit is contained in:
Juan Linietsky 2019-03-03 17:12:19 -03:00
parent 4d875f115c
commit ae886a6f32
4 changed files with 30 additions and 2 deletions

View file

@ -518,6 +518,7 @@ public:
bool is_restart_on_exit_set() const;
List<String> get_restart_on_exit_arguments() const;
virtual void process_and_drop_events() { }
OS();
virtual ~OS();
};

View file

@ -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();
}
}

View file

@ -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;

View file

@ -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();
};