Windows: Fix mouse handling regression

This commit is contained in:
Pedro J. Estébanez 2024-04-08 13:02:58 +02:00
parent e5b4ef8e95
commit bdfe76b200
2 changed files with 7 additions and 8 deletions

View file

@ -3930,7 +3930,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} }
mm->set_relative_screen_position(mm->get_relative()); mm->set_relative_screen_position(mm->get_relative());
if ((windows[window_id].window_has_focus || windows[window_id].is_popup) && mm->get_relative() != Vector2()) { if ((windows[window_id].window_focused || windows[window_id].is_popup) && mm->get_relative() != Vector2()) {
Input::get_singleton()->parse_input_event(mm); Input::get_singleton()->parse_input_event(mm);
} }
} }
@ -3978,7 +3978,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
windows[window_id].last_pen_inverted = inverted; windows[window_id].last_pen_inverted = inverted;
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode. // Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) { if (!windows[window_id].window_focused && mouse_mode == MOUSE_MODE_CAPTURED) {
break; break;
} }
@ -4028,7 +4028,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_relative_screen_position(mm->get_relative()); mm->set_relative_screen_position(mm->get_relative());
old_x = mm->get_position().x; old_x = mm->get_position().x;
old_y = mm->get_position().y; old_y = mm->get_position().y;
if (windows[window_id].window_has_focus || window_get_active_popup() == window_id) { if (windows[window_id].window_focused || window_get_active_popup() == window_id) {
Input::get_singleton()->parse_input_event(mm); Input::get_singleton()->parse_input_event(mm);
} }
} }
@ -4114,7 +4114,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} }
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode. // Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) { if (!windows[window_id].window_focused && mouse_mode == MOUSE_MODE_CAPTURED) {
break; break;
} }
@ -4177,7 +4177,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
mm->set_relative_screen_position(mm->get_relative()); mm->set_relative_screen_position(mm->get_relative());
old_x = mm->get_position().x; old_x = mm->get_position().x;
old_y = mm->get_position().y; old_y = mm->get_position().y;
if (windows[window_id].window_has_focus || window_get_active_popup() == window_id) { if (windows[window_id].window_focused || window_get_active_popup() == window_id) {
Input::get_singleton()->parse_input_event(mm); Input::get_singleton()->parse_input_event(mm);
} }
@ -4229,7 +4229,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} }
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode. // Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) { if (!windows[window_id].window_focused && mouse_mode == MOUSE_MODE_CAPTURED) {
break; break;
} }
@ -4725,7 +4725,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break; } break;
case WM_SETCURSOR: { case WM_SETCURSOR: {
if (LOWORD(lParam) == HTCLIENT) { if (LOWORD(lParam) == HTCLIENT) {
if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) { if (windows[window_id].window_focused && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) {
// Hide the cursor. // Hide the cursor.
if (hCursor == nullptr) { if (hCursor == nullptr) {
hCursor = SetCursor(nullptr); hCursor = SetCursor(nullptr);

View file

@ -391,7 +391,6 @@ class DisplayServerWindows : public DisplayServer {
bool was_maximized = false; bool was_maximized = false;
bool always_on_top = false; bool always_on_top = false;
bool no_focus = false; bool no_focus = false;
bool window_has_focus = false;
bool exclusive = false; bool exclusive = false;
bool context_created = false; bool context_created = false;
bool mpass = false; bool mpass = false;