[gtk/wip/fanc999/gtk-3-24-meson-msvc: 47/297] Make _gdk_quartz_window_flush a no-op for MacOS 10.14 and later.



commit e099e56293b92e6c0b369a4790c00811f22ee1ca
Author: John Ralls <jralls ceridwen us>
Date:   Fri Nov 23 17:12:10 2018 +0900

    Make _gdk_quartz_window_flush a no-op for MacOS 10.14 and later.
    
    According to Apple's docs it's no longer necessary as Cocoa will notice
    any changes and call drawRect as needed.

 gdk/quartz/gdkwindow-quartz.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 47857156e8..33779073cd 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -221,10 +221,14 @@ gdk_window_impl_quartz_finalize (GObject *object)
  *
  * If drawable NULL, no flushing is done, only registering that a flush was
  * done externally.
+ *
+ * Note: As of MacOS 10.14 NSWindow flushWindow is deprecated because
+ * Quartz has the ability to handle deferred drawing on its own.
  */
 void
 _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
 {
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
   static struct timeval prev_tv;
   static gint intervals[4];
   static gint index;
@@ -250,6 +254,7 @@ _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
     }
   else
     prev_tv = tv;
+#endif
 }
 
 static cairo_user_data_key_t gdk_quartz_cairo_key;
@@ -380,7 +385,7 @@ _gdk_quartz_window_process_updates_recurse (GdkWindow *window,
 
           toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
           nswindow = toplevel_impl->toplevel;
-
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
           /* In theory, we could skip the flush disabling, since we only
            * have one NSView.
            */
@@ -390,6 +395,7 @@ _gdk_quartz_window_process_updates_recurse (GdkWindow *window,
               [nswindow disableFlushWindow];
               update_nswindows = g_slist_prepend (update_nswindows, nswindow);
             }
+#endif
         }
     }
 
@@ -413,10 +419,12 @@ _gdk_quartz_display_before_process_all_updates (GdkDisplay *display)
     {
       [NSAnimationContext endGrouping];
     }
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
   else
     {
       NSDisableScreenUpdates ();
     }
+#endif
 }
 
 void
@@ -434,9 +442,10 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
       [[nswindow contentView] displayIfNeeded];
 
       _gdk_quartz_window_flush (NULL);
-
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
       [nswindow enableFlushWindow];
       [nswindow flushWindow];
+#endif
       [nswindow release];
 
       tmp_list = tmp_list->next;
@@ -450,10 +459,12 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
     {
       [NSAnimationContext beginGrouping];
     }
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
   else
     {
       NSEnableScreenUpdates ();
     }
+#endif
 }
 
 static const gchar *


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