Skip to content

Commit dc91479

Browse files
authored
Merge pull request #90382 from RandomShaper/win_focus_fix
Windows: Fix mouse handling regression
2 parents a5565c8 + bdfe76b commit dc91479

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

platform/windows/display_server_windows.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,7 +3956,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
39563956
}
39573957
mm->set_relative_screen_position(mm->get_relative());
39583958

3959-
if ((windows[window_id].window_has_focus || windows[window_id].is_popup) && mm->get_relative() != Vector2()) {
3959+
if ((windows[window_id].window_focused || windows[window_id].is_popup) && mm->get_relative() != Vector2()) {
39603960
Input::get_singleton()->parse_input_event(mm);
39613961
}
39623962
}
@@ -4004,7 +4004,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
40044004
windows[window_id].last_pen_inverted = inverted;
40054005

40064006
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
4007-
if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) {
4007+
if (!windows[window_id].window_focused && mouse_mode == MOUSE_MODE_CAPTURED) {
40084008
break;
40094009
}
40104010

@@ -4054,7 +4054,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
40544054
mm->set_relative_screen_position(mm->get_relative());
40554055
old_x = mm->get_position().x;
40564056
old_y = mm->get_position().y;
4057-
if (windows[window_id].window_has_focus || window_get_active_popup() == window_id) {
4057+
if (windows[window_id].window_focused || window_get_active_popup() == window_id) {
40584058
Input::get_singleton()->parse_input_event(mm);
40594059
}
40604060
}
@@ -4140,7 +4140,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
41404140
}
41414141

41424142
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
4143-
if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) {
4143+
if (!windows[window_id].window_focused && mouse_mode == MOUSE_MODE_CAPTURED) {
41444144
break;
41454145
}
41464146

@@ -4203,7 +4203,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
42034203
mm->set_relative_screen_position(mm->get_relative());
42044204
old_x = mm->get_position().x;
42054205
old_y = mm->get_position().y;
4206-
if (windows[window_id].window_has_focus || window_get_active_popup() == window_id) {
4206+
if (windows[window_id].window_focused || window_get_active_popup() == window_id) {
42074207
Input::get_singleton()->parse_input_event(mm);
42084208
}
42094209

@@ -4255,7 +4255,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
42554255
}
42564256

42574257
// Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
4258-
if (!windows[window_id].window_has_focus && mouse_mode == MOUSE_MODE_CAPTURED) {
4258+
if (!windows[window_id].window_focused && mouse_mode == MOUSE_MODE_CAPTURED) {
42594259
break;
42604260
}
42614261

@@ -4764,7 +4764,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
47644764
} break;
47654765
case WM_SETCURSOR: {
47664766
if (LOWORD(lParam) == HTCLIENT) {
4767-
if (windows[window_id].window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) {
4767+
if (windows[window_id].window_focused && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED_HIDDEN)) {
47684768
// Hide the cursor.
47694769
if (hCursor == nullptr) {
47704770
hCursor = SetCursor(nullptr);

platform/windows/display_server_windows.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ class DisplayServerWindows : public DisplayServer {
392392
bool was_maximized = false;
393393
bool always_on_top = false;
394394
bool no_focus = false;
395-
bool window_has_focus = false;
396395
bool exclusive = false;
397396
bool context_created = false;
398397
bool mpass = false;

0 commit comments

Comments
 (0)