From 88feacdad53cd315d6f3e25cac186ee05717f0e2 Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Mon, 31 Oct 2022 22:58:56 +0100 Subject: Fix mouse offset for unfocused popups On Windows, the mouse was offset, when unfocused popups were used, like the Editor menu. --- platform/windows/display_server_windows.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index d99670243e..9d0a2578fb 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2882,6 +2882,12 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA old_x = mm->get_position().x; old_y = mm->get_position().y; + if (!windows[receiving_window_id].window_has_focus) { + // In case of unfocused Popups, adjust event position. + Point2i pos = mm->get_position() - window_get_position(receiving_window_id) + window_get_position(window_id); + mm->set_position(pos); + mm->set_global_position(pos); + } Input::get_singleton()->parse_input_event(mm); } break; -- cgit v1.2.3