Browse Source

video: Save pending window events when a window is hidden by the window manager

The window manager might hide/unmap the window when it is minimized, in which case the fullscreen and maximized flags must be preserved as pending flags so the window will be restored to the proper state when shown/mapped on restoration.
Frank Praznik 1 năm trước cách đây
mục cha
commit
ae4484f4e5
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      src/video/SDL_video.c

+ 6 - 0
src/video/SDL_video.c

@@ -3456,6 +3456,12 @@ void SDL_OnWindowShown(SDL_Window *window)
 
 void SDL_OnWindowHidden(SDL_Window *window)
 {
+    /* Store the maximized and fullscreen flags for restoration later, in case
+     * this was initiated by the window manager due to the window being unmapped
+     * when minimized.
+     */
+    window->pending_flags = (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_MAXIMIZED));
+
     /* The window is already hidden at this point, so just change the mode back if necessary. */
     SDL_UpdateFullscreenMode(window, SDL_FALSE, SDL_FALSE);
 }