From 33c92af2b5f3430ee99c15efbca237a01c7d9e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Mon, 4 Aug 2025 15:14:27 +0300 Subject: [PATCH] [Windows] Release mouse buttons after native window drag/resize operation. --- platform/windows/display_server_windows.cpp | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index e035ea5bfba..6a23e93f977 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4255,6 +4255,19 @@ void DisplayServerWindows::window_start_drag(WindowID p_window) { ScreenToClient(wd.hWnd, &coords); SendMessage(wd.hWnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(coords.x, coords.y)); + + for (int btn = (int)MouseButton::LEFT; btn <= (int)MouseButton::MB_XBUTTON2; btn++) { + if (Input::get_singleton()->is_mouse_button_pressed(MouseButton(btn))) { + Ref mb; + mb.instantiate(); + mb->set_window_id(p_window); + mb->set_pressed(false); + mb->set_button_index(MouseButton::LEFT); + mb->set_position(Vector2(coords.x, coords.y)); + mb->set_global_position(mb->get_position()); + Input::get_singleton()->parse_input_event(mb); + } + } } void DisplayServerWindows::window_start_resize(WindowResizeEdge p_edge, WindowID p_window) { @@ -4305,6 +4318,19 @@ void DisplayServerWindows::window_start_resize(WindowResizeEdge p_edge, WindowID } SendMessage(wd.hWnd, WM_SYSCOMMAND, SC_SIZE | op, MAKELPARAM(coords.x, coords.y)); + + for (int btn = (int)MouseButton::LEFT; btn <= (int)MouseButton::MB_XBUTTON2; btn++) { + if (Input::get_singleton()->is_mouse_button_pressed(MouseButton(btn))) { + Ref mb; + mb.instantiate(); + mb->set_window_id(p_window); + mb->set_pressed(false); + mb->set_button_index(MouseButton::LEFT); + mb->set_position(Vector2(coords.x, coords.y)); + mb->set_global_position(mb->get_position()); + Input::get_singleton()->parse_input_event(mb); + } + } } void DisplayServerWindows::set_context(Context p_context) {