[gtk/wip.win32.fixes: 146/151] GDK-Win32: Cleanup fix for maximizing/minimizing




commit 292441a9f6aaddbe3bb5a3548a66e46002c82245
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 77051a9739..7d05c64479 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 6325c31f58..e07013f3da 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1443,6 +1443,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
@@ -2208,12 +2209,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);
 
@@ -2321,12 +2316,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))
     {
@@ -4207,6 +4198,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);
@@ -4425,8 +4419,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);
 }
@@ -4604,8 +4597,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;
 
@@ -4614,16 +4605,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]