summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-03 22:33:12 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-03 22:33:12 +0100
commit015dc492de33a41eaeb14c0503a6be10466fe457 (patch)
tree61141aaeac171843eff6a7db8d7a5b34b37a634b /platform/windows
parente80356bf3bafdac1e702bae2480e246ea78c996f (diff)
parent79401f8dc2167f67fd4d6e7e3ad69d9595f4a53b (diff)
Merge pull request #69390 from Sauermann/fix-mouse-event-position
Fix incorrect mouse event position while hovering different window
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp9
1 files changed, 4 insertions, 5 deletions
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);