@@ -266,24 +266,25 @@ impl WindowFlags {
266
266
}
267
267
}
268
268
269
- if diff. contains ( WindowFlags :: MINIMIZED ) || new. contains ( WindowFlags :: MINIMIZED ) {
269
+ if diff. contains ( WindowFlags :: MAXIMIZED ) || new. contains ( WindowFlags :: MAXIMIZED ) {
270
270
unsafe {
271
271
winuser:: ShowWindow (
272
272
window,
273
- match new. contains ( WindowFlags :: MINIMIZED ) {
274
- true => winuser:: SW_MINIMIZE ,
273
+ match new. contains ( WindowFlags :: MAXIMIZED ) {
274
+ true => winuser:: SW_MAXIMIZE ,
275
275
false => winuser:: SW_RESTORE ,
276
276
} ,
277
277
) ;
278
278
}
279
279
}
280
280
281
- if diff. contains ( WindowFlags :: MAXIMIZED ) || new. contains ( WindowFlags :: MAXIMIZED ) {
281
+ // Minimize operations should execute after maximize for proper window animations
282
+ if diff. contains ( WindowFlags :: MINIMIZED ) {
282
283
unsafe {
283
284
winuser:: ShowWindow (
284
285
window,
285
- match new. contains ( WindowFlags :: MAXIMIZED ) {
286
- true => winuser:: SW_MAXIMIZE ,
286
+ match new. contains ( WindowFlags :: MINIMIZED ) {
287
+ true => winuser:: SW_MINIMIZE ,
287
288
false => winuser:: SW_RESTORE ,
288
289
} ,
289
290
) ;
@@ -296,8 +297,11 @@ impl WindowFlags {
296
297
unsafe {
297
298
winuser:: SendMessageW ( window, * event_loop:: SET_RETAIN_STATE_ON_SIZE_MSG_ID , 1 , 0 ) ;
298
299
299
- winuser:: SetWindowLongW ( window, winuser:: GWL_STYLE , style as _ ) ;
300
- winuser:: SetWindowLongW ( window, winuser:: GWL_EXSTYLE , style_ex as _ ) ;
300
+ // This condition is necessary to avoid having an unrestorable window
301
+ if !new. contains ( WindowFlags :: MINIMIZED ) {
302
+ winuser:: SetWindowLongW ( window, winuser:: GWL_STYLE , style as _ ) ;
303
+ winuser:: SetWindowLongW ( window, winuser:: GWL_EXSTYLE , style_ex as _ ) ;
304
+ }
301
305
302
306
let mut flags = winuser:: SWP_NOZORDER
303
307
| winuser:: SWP_NOMOVE
0 commit comments