mirror of
https://github.com/godotengine/godot
synced 2024-09-05 09:08:28 +00:00
Merge pull request #90382 from RandomShaper/win_focus_fix
Windows: Fix mouse handling regression
This commit is contained in:
commit
dc91479082
|
@ -3956,7 +3956,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4004,7 +4004,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4054,7 +4054,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4140,7 +4140,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4203,7 +4203,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4255,7 +4255,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4764,7 +4764,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);
|
||||||
|
|
|
@ -392,7 +392,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;
|
||||||
|
|
Loading…
Reference in a new issue