[gtk/wip/chergert/gdk-macos-for-master] macos: freeze updates until surface is mapped




commit b3a3974265cfec1e22c55826ff2adb043afabecd
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 2 13:10:23 2020 -0800

    macos: freeze updates until surface is mapped
    
    This more closely matches the X11 backend in terms of freezing
    updates on the surface initially until we get mapped.

 gdk/macos/gdkmacossurface.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 5d6f2e1aaa..7c1c03f44d 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -112,15 +112,21 @@ gdk_macos_surface_hide (GdkSurface *surface)
 {
   GdkMacosSurface *self = (GdkMacosSurface *)surface;
   GdkSeat *seat;
+  gboolean was_mapped;
 
   g_assert (GDK_IS_MACOS_SURFACE (self));
 
+  was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
+
   seat = gdk_display_get_default_seat (surface->display);
   gdk_seat_ungrab (seat);
 
   [self->window hide];
 
   _gdk_surface_clear_update_area (surface);
+
+  if (was_mapped)
+    gdk_surface_freeze_updates (GDK_SURFACE (self));
 }
 
 static int
@@ -544,7 +550,10 @@ _gdk_macos_surface_new (GdkMacosDisplay   *display,
     }
 
   if (ret != NULL)
-    _gdk_macos_surface_monitor_changed (ret);
+    {
+      gdk_surface_freeze_updates (GDK_SURFACE (ret));
+      _gdk_macos_surface_monitor_changed (ret);
+    }
 
   g_object_unref (frame_clock);
 
@@ -766,6 +775,7 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
         {
           _gdk_macos_surface_update_position (self);
           gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
+          gdk_surface_thaw_updates (GDK_SURFACE (self));
         }
     }
 


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