summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-01 14:46:30 +0100
committerGitHub <noreply@github.com>2022-02-01 14:46:30 +0100
commitea12094f19b028c1dcf6d402b8cbb3296b2065a8 (patch)
tree791f349fbca6b49952366d3034235ff0b2873e39 /platform/windows
parentd4e21b7d62318e1552803e1e76d6013cd7a38075 (diff)
parentc058361a238892b0384cd648f2a8de3a5d9622a6 (diff)
Merge pull request #57497 from Geometror/fix-mouse-mode
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 0e41b89c13..d288c27016 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -97,7 +97,10 @@ String DisplayServerWindows::get_name() const {
void DisplayServerWindows::_set_mouse_mode_impl(MouseMode p_mode) {
if (windows.has(MAIN_WINDOW_ID) && (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_CONFINED || p_mode == MOUSE_MODE_CONFINED_HIDDEN)) {
// Mouse is grabbed (captured or confined).
- WindowData &wd = windows[MAIN_WINDOW_ID];
+
+ WindowID window_id = windows.has(last_focused_window) ? last_focused_window : MAIN_WINDOW_ID;
+
+ WindowData &wd = windows[window_id];
RECT clipRect;
GetClientRect(wd.hWnd, &clipRect);