[gtk/matthiasc/surface-state-rework: 66/80] x11: Use resize counting for freezing updates too




commit fef29e80090e053a69841eb7d37381f8189761f1
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Dec 5 00:07:21 2020 +0100

    x11: Use resize counting for freezing updates too
    
    It's already keep strack of when we're waiting for configure events, so
    lets reuse it. This fixes an issue where reshown dialogs wouldn't
    reappear.

 gdk/x11/gdkdisplay-x11.c | 10 ----------
 gdk/x11/gdksurface-x11.c | 25 +++++++++++++++++--------
 gdk/x11/gdksurface-x11.h |  2 --
 3 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 692f85230c..73529906c5 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -920,16 +920,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
              int ty = 0;
              Window child_window = 0;
 
-              if (surface_impl->pending_configure_events == 1)
-                {
-                  surface_impl->pending_configure_events = 0;
-                  gdk_surface_thaw_updates (surface);
-                }
-              else if (surface_impl->pending_configure_events > 1)
-                {
-                  surface_impl->pending_configure_events--;
-                }
-
               x = y = 0;
              gdk_x11_display_error_trap_push (display);
              if (XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface),
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 15c296ae45..a4b6e5f6ce 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -1626,8 +1626,13 @@ x11_surface_resize (GdkSurface *surface,
     }
   else
     {
-      if (width * impl->surface_scale != impl->unscaled_width || height * impl->surface_scale != 
impl->unscaled_height)
-        surface->resize_count += 1;
+      if (width * impl->surface_scale != impl->unscaled_width ||
+          height * impl->surface_scale != impl->unscaled_height)
+        {
+          surface->resize_count++;
+          if (surface->resize_count == 1)
+            gdk_surface_freeze_updates (surface);
+        }
     }
 }
 
@@ -1678,8 +1683,13 @@ x11_surface_move_resize (GdkSurface *surface,
     }
   else
     {
-      if (width * impl->surface_scale != impl->unscaled_width || height * impl->surface_scale != 
impl->unscaled_height)
-        surface->resize_count += 1;
+      if (width * impl->surface_scale != impl->unscaled_width ||
+          height * impl->surface_scale != impl->unscaled_height)
+        {
+          surface->resize_count++;
+          if (surface->resize_count == 1)
+            gdk_surface_freeze_updates (surface);
+        }
     }
 }
 
@@ -4244,6 +4254,9 @@ _gdk_x11_moveresize_configure_done (GdkDisplay *display,
   XEvent *tmp_event;
   MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
 
+  gdk_surface_thaw_updates (surface);
+  gdk_surface_request_layout (surface);
+
   if (!mv_resize || surface != mv_resize->moveresize_surface)
     return FALSE;
 
@@ -5068,10 +5081,6 @@ gdk_x11_toplevel_present (GdkToplevel       *toplevel,
                           size.shadow.bottom);
     }
 
-  impl->pending_configure_events++;
-  if (impl->pending_configure_events == 1)
-    gdk_surface_freeze_updates (surface);
-
   if (gdk_toplevel_layout_get_maximized (layout))
     gdk_x11_surface_maximize (surface);
   else
diff --git a/gdk/x11/gdksurface-x11.h b/gdk/x11/gdksurface-x11.h
index 1e47827971..6fd7122ba0 100644
--- a/gdk/x11/gdksurface-x11.h
+++ b/gdk/x11/gdksurface-x11.h
@@ -72,8 +72,6 @@ struct _GdkX11Surface
   int unscaled_width;
   int unscaled_height;
 
-  int pending_configure_events;
-
   struct {
     int configured_width;
     int configured_height;


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