mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-26 03:36:32 +11:00
Windows: Fix window.set_maximized() (#672)
* Windows: Fix window.set_maximized() * Add window.set_maximized fix to CHANGELOG. * Windows: use same style for set_maximized as other set_x(bool) methods
This commit is contained in:
parent
50008dff3d
commit
5d5fcb3911
2 changed files with 19 additions and 19 deletions
|
@ -11,6 +11,7 @@
|
||||||
- Added `WindowBuilderExt::with_gtk_theme_variant` to X11-specific `WindowBuilder` functions.
|
- Added `WindowBuilderExt::with_gtk_theme_variant` to X11-specific `WindowBuilder` functions.
|
||||||
- Fixed UTF8 handling bug in X11 `set_title` function.
|
- Fixed UTF8 handling bug in X11 `set_title` function.
|
||||||
- On Windows, `Window::set_cursor` now applies immediately instead of requiring specific events to occur first.
|
- On Windows, `Window::set_cursor` now applies immediately instead of requiring specific events to occur first.
|
||||||
|
- On Windows, fix window.set_maximized().
|
||||||
|
|
||||||
# Version 0.17.2 (2018-08-19)
|
# Version 0.17.2 (2018-08-19)
|
||||||
|
|
||||||
|
|
|
@ -453,25 +453,24 @@ impl Window {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_maximized(&self, maximized: bool) {
|
pub fn set_maximized(&self, maximized: bool) {
|
||||||
let mut window_state = self.window_state.lock().unwrap();
|
let mut window_state = self.window_state.lock().unwrap();
|
||||||
window_state.maximized = true;
|
if mem::replace(&mut window_state.maximized, maximized) != maximized {
|
||||||
// We only maximize if we're not in fullscreen.
|
// We only maximize if we're not in fullscreen.
|
||||||
if window_state.fullscreen.is_none() {
|
if window_state.fullscreen.is_none() {
|
||||||
return;
|
let window = self.window.clone();
|
||||||
}
|
unsafe {
|
||||||
|
// `ShowWindow` resizes the window, so it must be called from the main thread.
|
||||||
let window = self.window.clone();
|
self.events_loop_proxy.execute_in_thread(move |_| {
|
||||||
unsafe {
|
winuser::ShowWindow(
|
||||||
// `ShowWindow` resizes the window, so it must be called from the main thread.
|
window.0,
|
||||||
self.events_loop_proxy.execute_in_thread(move |_| {
|
if maximized {
|
||||||
winuser::ShowWindow(
|
winuser::SW_MAXIMIZE
|
||||||
window.0,
|
} else {
|
||||||
if maximized {
|
winuser::SW_RESTORE
|
||||||
winuser::SW_MAXIMIZE
|
},
|
||||||
} else {
|
);
|
||||||
winuser::SW_RESTORE
|
});
|
||||||
},
|
}
|
||||||
);
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue