mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #69390 from Sauermann/fix-mouse-event-position
Fix incorrect mouse event position while hovering different window
This commit is contained in:
commit
015dc492de
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user