[gtk/wip/chergert/macos-iosurface] macos: swap buffers before showing window



commit d4ffb866605f3a7c102fa96724b0b70e44c74f17
Author: Christian Hergert <christian hergert me>
Date:   Sat Feb 12 02:51:29 2022 -0800

    macos: swap buffers before showing window
    
    We want to increase chances the window has the right contents when it is
    displayed to the user.

 gdk/macos/gdkmacossurface.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index 859a5c935d..6966db7894 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -1142,6 +1142,12 @@ _gdk_macos_surface_swap_buffers (GdkMacosSurface      *self,
   g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
   g_return_if_fail (damage != NULL);
 
+  /* This code looks like it swaps buffers, but since the IOSurfaceRef
+   * appears to be retained on the other side, we really just ask all
+   * of the GdkMacosTile CALayer's to update their contents.
+   */
+  [self->window swapBuffer:self->buffer withDamage:damage];
+
   /* We might have delayed actually showing the window until the buffer
    * contents are ready to be displayed. Doing so ensures that we don't
    * get a point where we might have invalid buffer contents before we
@@ -1149,10 +1155,4 @@ _gdk_macos_surface_swap_buffers (GdkMacosSurface      *self,
    */
   if G_UNLIKELY (self->show_on_next_swap)
     _gdk_macos_surface_do_delayed_show (self);
-
-  /* This code looks like it swaps buffers, but since the IOSurfaceRef
-   * appears to be retained on the other side, we really just ask all
-   * of the GdkMacosTile CALayer's to update their contents.
-   */
-  [self->window swapBuffer:self->buffer withDamage:damage];
 }


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