From aec5a9fa096e72a9430223255be508a9dc78687b Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 27 Nov 2019 04:49:15 +0100 Subject: [PATCH] Stop refocusing window when switching from fullscreen to windowed (#1285) * Stop refocusing window when switching from fullscreen to windowed * Update Changelog. --- CHANGELOG.md | 1 + src/platform_impl/windows/window.rs | 9 +++++++-- src/platform_impl/windows/window_state.rs | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e76e35a3..1c9838f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - On X11, fix events not being reported when using `run_return`. - On X11, fix key modifiers being incorrectly reported. - On X11, fix window creation hanging when another window is fullscreen. +- On Windows, fix focusing unfocused windows when switching from fullscreen to windowed. # 0.20.0 Alpha 4 (2019-10-18) diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 629eae17..783ad5e7 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -202,7 +202,10 @@ impl Window { y as c_int, 0, 0, - winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER | winuser::SWP_NOSIZE, + winuser::SWP_ASYNCWINDOWPOS + | winuser::SWP_NOZORDER + | winuser::SWP_NOSIZE + | winuser::SWP_NOACTIVATE, ); winuser::UpdateWindow(self.window.0); } @@ -615,7 +618,9 @@ impl Window { client_rect.top, client_rect.right - client_rect.left, client_rect.bottom - client_rect.top, - winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOZORDER, + winuser::SWP_ASYNCWINDOWPOS + | winuser::SWP_NOZORDER + | winuser::SWP_NOACTIVATE, ); winuser::UpdateWindow(window.0); } diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index 105d71e6..be98bcc9 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -255,7 +255,10 @@ impl WindowFlags { 0, 0, 0, - winuser::SWP_ASYNCWINDOWPOS | winuser::SWP_NOMOVE | winuser::SWP_NOSIZE, + winuser::SWP_ASYNCWINDOWPOS + | winuser::SWP_NOMOVE + | winuser::SWP_NOSIZE + | winuser::SWP_NOACTIVATE, ); winuser::UpdateWindow(window); }