diff options
author | Hilderin <81109165+Hilderin@users.noreply.github.com> | 2024-08-16 18:40:46 -0400 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-16 17:12:26 +0200 |
commit | 8496e0738f8e5d0fbced34572fa8aa8dc7cb483f (patch) | |
tree | 6a8b803569ff419cc7b011daca80fd7684bfba34 /platform | |
parent | 20ce427a6caf5f86f77dcdd4e548e48bcf93926c (diff) | |
download | redot-engine-8496e0738f8e5d0fbced34572fa8aa8dc7cb483f.tar.gz |
Fix drag&drop between window on Windows
(cherry picked from commit 0987a9dc0690c272534d2e550296b233a7e53eb3)
Diffstat (limited to 'platform')
-rw-r--r-- | platform/windows/display_server_windows.cpp | 10 | ||||
-rw-r--r-- | platform/windows/display_server_windows.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 88ab9a4af0..ca143b3a4a 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4805,6 +4805,16 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA Input::get_singleton()->parse_input_event(mbd); } + // Propagate the button up event to the window on which the button down + // event was triggered. This is needed for drag & drop to work between windows, + // because the engine expects events to keep being processed + // on the same window dragging started. + if (mb->is_pressed()) { + last_mouse_button_down_window = window_id; + } else if (last_mouse_button_down_window != INVALID_WINDOW_ID) { + mb->set_window_id(last_mouse_button_down_window); + last_mouse_button_down_window = INVALID_WINDOW_ID; + } } break; case WM_WINDOWPOSCHANGED: { diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index de5b813953..532cf22d05 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -523,7 +523,7 @@ class DisplayServerWindows : public DisplayServer { RBMap<WindowID, WindowData> windows; WindowID last_focused_window = INVALID_WINDOW_ID; - + WindowID last_mouse_button_down_window = INVALID_WINDOW_ID; HCURSOR hCursor; WNDPROC user_proc = nullptr; |