diff --git a/CHANGELOG.md b/CHANGELOG.md index a0eece88..ea99659b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - On Windows, location of `WindowEvent::Touch` are window client coordinates instead of screen coordinates. - On X11, fix delayed events after window redraw. - On macOS, add `WindowBuilderExt::with_disallow_hidpi` to have the option to turn off best resolution openGL surface. +- On Windows, screen saver won't start if the window is in fullscreen mode. # 0.20.0 Alpha 2 (2019-07-09) diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 1d964270..c84716f7 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -1020,6 +1020,17 @@ unsafe extern "system" fn public_window_callback( // other unwanted default hotkeys as well. winuser::WM_SYSCHAR => 0, + winuser::WM_SYSCOMMAND => { + if wparam == winuser::SC_SCREENSAVE { + let window_state = subclass_input.window_state.lock(); + if window_state.fullscreen.is_some() { + return 0; + } + } + + winuser::DefWindowProcW(window, msg, wparam, lparam) + } + winuser::WM_MOUSEMOVE => { use crate::event::WindowEvent::{CursorEntered, CursorMoved}; let mouse_was_outside_window = { diff --git a/src/window.rs b/src/window.rs index dfde6713..e095e38d 100644 --- a/src/window.rs +++ b/src/window.rs @@ -224,6 +224,10 @@ impl WindowBuilder { /// Sets the window fullscreen state. None means a normal window, Some(MonitorHandle) /// means a fullscreen window on that specific monitor + /// + /// ## Platform-specific + /// + /// - **Windows:** Screen saver is disabled in fullscreen mode. #[inline] pub fn with_fullscreen(mut self, monitor: Option) -> WindowBuilder { self.window.fullscreen = monitor; @@ -534,6 +538,7 @@ impl Window { /// ## Platform-specific /// /// - **iOS:** Can only be called on the main thread. + /// - **Windows:** Screen saver is disabled in fullscreen mode. #[inline] pub fn set_fullscreen(&self, monitor: Option) { self.window.set_fullscreen(monitor)