mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 13:31:29 +11:00
Process WM_SYSCOMMAND to forbid screen savers in fullscreen mode (#1065)
* Process WM_SYSCOMMAND to forbid screen savers in fullscreen mode Fixes #1047 * Update CHANGELOG.md and documentation to reflect changes from issue #1065 * Updated documentation of window.Window.set_fullscreen to match the documentation of window.WindowBuilder.with_fullscreen.
This commit is contained in:
parent
f4e9bf51db
commit
e5ba79db04
|
@ -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)
|
||||
|
||||
|
|
|
@ -1020,6 +1020,17 @@ unsafe extern "system" fn public_window_callback<T>(
|
|||
// 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 = {
|
||||
|
|
|
@ -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<MonitorHandle>) -> 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<MonitorHandle>) {
|
||||
self.window.set_fullscreen(monitor)
|
||||
|
|
Loading…
Reference in a new issue