Windows: Fix panic when calling set_fullscreen(None) (#502)

* Windows: Fix panic for set_fullscreen(None) (#501)

* Add condition to prevent panic

Trying to call set_fullscreen(None) on a window that has never been in
fullscreen mode caused a panic before this change.
The responsible method now simply checks if this precondition is met and
returns (does nothing) otherwise.

* Add entry to CHANGELOG

* Add platform specification to CHANGELOG entry

Forgot to add that the to_fullscreen(None) bugfix is Windows only in
CHANGELOG.
This commit is contained in:
Jack Magnus 2018-05-08 14:16:49 +02:00 committed by Francesca Frangipane
parent 102dd07456
commit 363261077f
2 changed files with 8 additions and 0 deletions

View file

@ -425,6 +425,13 @@ impl Window {
unsafe fn restore_saved_window(&self) {
let window_state = self.window_state.lock().unwrap();
// 'saved_window_info' can be None if the window has never been
// in fullscreen mode before this method gets called.
if window_state.saved_window_info.is_none() {
return;
}
// Reset original window style and size. The multiple window size/moves
// here are ugly, but if SetWindowPos() doesn't redraw, the taskbar won't be
// repainted. Better-looking methods welcome.