[gtk/wip/chergert/macos-iosurface] avoid nil/buffer set hack



commit 8201be53b4278dcd004713337631d6258e6af472
Author: Christian Hergert <christian hergert me>
Date:   Fri Feb 11 16:32:37 2022 -0800

    avoid nil/buffer set hack
    
    we can just use the internal API directly, its not going anywhere

 gdk/macos/GdkMacosTile.c | 6 ++++--
 gdk/macos/GdkMacosTile.h | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gdk/macos/GdkMacosTile.c b/gdk/macos/GdkMacosTile.c
index ef0f7bfb5b..54e90434f5 100644
--- a/gdk/macos/GdkMacosTile.c
+++ b/gdk/macos/GdkMacosTile.c
@@ -37,8 +37,10 @@
 
 -(void)swapBuffer:(IOSurfaceRef)buffer withRect:(CGRect)rect
 {
-  self.contents = nil;
-  self.contents = (id)buffer;
+  if (self.contents == (id)buffer)
+    [(id<CanSetContentsChanged>)self setContentsChanged];
+  else
+    self.contents = (id)buffer;
 
   if (!CGRectEqualToRect ([self contentsRect], rect))
     self.contentsRect = rect;
diff --git a/gdk/macos/GdkMacosTile.h b/gdk/macos/GdkMacosTile.h
index 296a8d7c70..ada07ebcf3 100644
--- a/gdk/macos/GdkMacosTile.h
+++ b/gdk/macos/GdkMacosTile.h
@@ -24,6 +24,10 @@
 
 #define GDK_IS_MACOS_TILE(obj) ((obj) && [obj isKindOfClass:[GdkMacosTile class]])
 
+@protocol CanSetContentsChanged
+-(void)setContentsChanged;
+@end
+
 @interface GdkMacosTile : CALayer
 {
 };


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