File tree 2 files changed +21
-11
lines changed
src/platform_impl/windows
2 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -767,9 +767,10 @@ impl Window {
767
767
let placement = unsafe {
768
768
let mut placement = WINDOWPLACEMENT :: default ( ) ;
769
769
let _ = GetWindowPlacement ( hwnd, & mut placement) ;
770
+ // set the `showCmd` to your needs when you use this placement below.
771
+ placement. showCmd = SW_NORMAL . 0 as u32 ;
770
772
placement
771
773
} ;
772
-
773
774
window_state. lock ( ) . saved_window = Some ( SavedWindow { placement } ) ;
774
775
775
776
let monitor = match & fullscreen {
@@ -798,7 +799,13 @@ impl Window {
798
799
}
799
800
None => {
800
801
let mut window_state_lock = window_state. lock ( ) ;
801
- if let Some ( SavedWindow { placement } ) = window_state_lock. saved_window . take ( ) {
802
+ if let Some ( SavedWindow { mut placement } ) = window_state_lock. saved_window . take ( ) {
803
+ if window_state_lock
804
+ . window_flags
805
+ . contains ( WindowFlags :: MAXIMIZED )
806
+ {
807
+ placement. showCmd = SW_MAXIMIZE . 0 as u32 ;
808
+ }
802
809
drop ( window_state_lock) ;
803
810
unsafe {
804
811
let _ = SetWindowPlacement ( hwnd, & placement) ;
Original file line number Diff line number Diff line change @@ -369,15 +369,18 @@ impl WindowFlags {
369
369
}
370
370
}
371
371
372
- if diff. contains ( WindowFlags :: MAXIMIZED ) || new. contains ( WindowFlags :: MAXIMIZED ) {
373
- unsafe {
374
- let _ = ShowWindow (
375
- window,
376
- match new. contains ( WindowFlags :: MAXIMIZED ) {
377
- true => SW_MAXIMIZE ,
378
- false => SW_RESTORE ,
379
- } ,
380
- ) ;
372
+ if diff. contains ( WindowFlags :: MAXIMIZED ) {
373
+ if new. contains ( WindowFlags :: MAXIMIZED ) {
374
+ let _ = unsafe { ShowWindow ( window, SW_MAXIMIZE ) } ;
375
+ } else {
376
+ if self . contains ( WindowFlags :: MARKER_BORDERLESS_FULLSCREEN ) {
377
+ let ( style, _) = self . to_window_styles ( ) ;
378
+ // not to set SW_RESTORE to restore the size, we keep it for borderless fullscreen
379
+ let unmaximized_style = style & !WS_MAXIMIZE ;
380
+ unsafe { SetWindowLongW ( window, GWL_STYLE , unmaximized_style. 0 as i32 ) } ;
381
+ } else {
382
+ let _ = unsafe { ShowWindow ( window, SW_RESTORE ) } ;
383
+ }
381
384
}
382
385
}
383
386
You can’t perform that action at this time.
0 commit comments