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:
Rob Horswell 2018-10-15 00:47:08 +01:00 committed by Francesca Plebani
parent 50008dff3d
commit 5d5fcb3911
2 changed files with 19 additions and 19 deletions

View file

@ -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)

View file

@ -453,12 +453,9 @@ 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(); let window = self.window.clone();
unsafe { unsafe {
// `ShowWindow` resizes the window, so it must be called from the main thread. // `ShowWindow` resizes the window, so it must be called from the main thread.
@ -474,6 +471,8 @@ impl Window {
}); });
} }
} }
}
}
unsafe fn set_fullscreen_style(&self, window_state: &mut WindowState) -> (LONG, LONG) { unsafe fn set_fullscreen_style(&self, window_state: &mut WindowState) -> (LONG, LONG) {
if window_state.fullscreen.is_none() || window_state.saved_window_info.is_none() { if window_state.fullscreen.is_none() || window_state.saved_window_info.is_none() {