From 79401f8dc2167f67fd4d6e7e3ad69d9595f4a53b Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Wed, 30 Nov 2022 13:39:31 +0100 Subject: Fix incorrect mouse event position while hovering different window --- platform/windows/display_server_windows.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'platform/windows') diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 29482213d8..c704a26b7a 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2910,11 +2910,10 @@ 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); + if (receiving_window_id != window_id) { + // Adjust event position relative to window distance when event is sent to a different window. + mm->set_position(mm->get_position() - window_get_position(receiving_window_id) + window_get_position(window_id)); + mm->set_global_position(mm->get_position()); } Input::get_singleton()->parse_input_event(mm); -- cgit v1.2.3