[gtk/fix-3728-3799: 64/69] GDK-Win32: Cleanup fix for maximizing/minimizing




commit 5d02379ffae6009bf0738706320512c9aadf14c1
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Jul 6 16:51:22 2021 +0800

    GDK-Win32: Cleanup fix for maximizing/minimizing
    
    Use the ->maximizing field instead of checking the toplevel surface state.

 gdk/win32/gdkevents-win32.c  |  5 ++++-
 gdk/win32/gdksurface-win32.c | 33 +++++++++------------------------
 2 files changed, 13 insertions(+), 25 deletions(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 7c28b88eb3..060af00864 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2772,7 +2772,10 @@ gdk_event_translate (MSG *msg,
                   windowpos->cy = our_mmi.ptMaxSize.y;
                 }
 
-              impl->maximizing = FALSE;
+              /*
+               * We turn off impl->maximizing later, after we shown 
+               * the window with SW_MAXIMIZE
+               */
             }
         }
 
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index a4e60bf232..6e74b94f52 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1442,6 +1442,7 @@ gdk_win32_surface_set_geometry_hints (GdkSurface         *window,
                           GDK_SURFACE_HWND (window)));
 
   fi = g_object_get_data (G_OBJECT (window), "fullscreen-info");
+
   if (fi)
     fi->hint_flags = geom_mask;
   else
@@ -2207,12 +2208,6 @@ unsnap (GdkSurface *window,
 
   GDK_NOTE (MISC, g_print ("Unsnapped window size %d x %d @ %d : %d\n", rect.width, rect.height, rect.x, 
rect.y));
 
-  if (GDK_IS_TOPLEVEL (window))
-    {
-      impl->drag_move_resize_context.native_move_resize_pending = FALSE;
-      impl->inhibit_configure = TRUE;
-    }
-
   gdk_win32_surface_move_resize (window, rect.x, rect.y,
                                  rect.width, rect.height);
 
@@ -2320,12 +2315,8 @@ snap_up (GdkSurface *window)
   height += impl->shadow_y;
 
   /* XXX: FIXME, AeroSnap snap_up() not really working well,
-   *
-   *    * The snap_up() puts the window at the top left corner.
-   *    * Without the following call, the height maximizes but we see a spew of
-   *      "GdkToplevelSize: geometry size (x,y) exceeds bounds" warnings
+   *      The snap_up() puts the surface at the top left corner.
    */
-  compute_toplevel_size (window, TRUE, &width, &height);
 
   if (GDK_IS_TOPLEVEL (window))
     {
@@ -4206,6 +4197,9 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
   else
     {
       GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
+      impl->maximizing = TRUE;
+      impl->inhibit_configure = TRUE;
+      impl->drag_move_resize_context.native_move_resize_pending = FALSE;
 
       monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
       mi.cbSize = sizeof (mi);
@@ -4424,8 +4418,7 @@ GtkShowWindow (GdkSurface *window,
     }
 
   /* Ensure that maximized window size is corrected later on */
-  if (cmd_show == SW_MAXIMIZE)
-    impl->maximizing = TRUE;
+  impl->maximizing = (cmd_show == SW_MAXIMIZE);
 
   return ShowWindow (hwnd, cmd_show);
 }
@@ -4603,8 +4596,6 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
 
       if (GDK_IS_TOPLEVEL (surface))
         {
-          gboolean maximize = FALSE;
-
           surface->x = rect.left / scale;
           surface->y = rect.top / scale;
 
@@ -4613,16 +4604,10 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
            * presented and it did not just undergo an AeroSnap op and it
            * was not minimized nor minimized nor fullscreen'ed.
            */
-          if (impl->toplevel_layout != NULL)
-            {
-              gdk_toplevel_layout_get_maximized (impl->toplevel_layout,
-                                                &maximize);
-              if (!maximize)
-                gdk_toplevel_layout_get_fullscreen (impl->toplevel_layout,
-                                                   &maximize);
-            }
+          if (impl->maximizing)
+            impl->inhibit_configure = TRUE;
 
-          if (!impl->inhibit_configure && !maximize)
+          if (!impl->inhibit_configure)
             impl->drag_move_resize_context.native_move_resize_pending = TRUE;
         }
       else if (GDK_IS_POPUP (surface))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]