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.
This commit is contained in:
John Ralls
2018-11-23 17:12:10 +09:00
parent 1165ab9d27
commit eb2799cd7a

View File

@ -221,10 +221,14 @@ gdk_window_impl_quartz_finalize (GObject *object)
* *
* If drawable NULL, no flushing is done, only registering that a flush was * If drawable NULL, no flushing is done, only registering that a flush was
* done externally. * 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 void
_gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl) _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
{ {
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
static struct timeval prev_tv; static struct timeval prev_tv;
static gint intervals[4]; static gint intervals[4];
static gint index; static gint index;
@ -250,6 +254,7 @@ _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
} }
else else
prev_tv = tv; prev_tv = tv;
#endif
} }
static cairo_user_data_key_t gdk_quartz_cairo_key; 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; toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
nswindow = toplevel_impl->toplevel; nswindow = toplevel_impl->toplevel;
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
/* In theory, we could skip the flush disabling, since we only /* In theory, we could skip the flush disabling, since we only
* have one NSView. * have one NSView.
*/ */
@ -390,6 +395,7 @@ _gdk_quartz_window_process_updates_recurse (GdkWindow *window,
[nswindow disableFlushWindow]; [nswindow disableFlushWindow];
update_nswindows = g_slist_prepend (update_nswindows, nswindow); update_nswindows = g_slist_prepend (update_nswindows, nswindow);
} }
#endif
} }
} }
@ -413,10 +419,12 @@ _gdk_quartz_display_before_process_all_updates (GdkDisplay *display)
{ {
[NSAnimationContext endGrouping]; [NSAnimationContext endGrouping];
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
else else
{ {
NSDisableScreenUpdates (); NSDisableScreenUpdates ();
} }
#endif
} }
void void
@ -434,9 +442,10 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
[[nswindow contentView] displayIfNeeded]; [[nswindow contentView] displayIfNeeded];
_gdk_quartz_window_flush (NULL); _gdk_quartz_window_flush (NULL);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
[nswindow enableFlushWindow]; [nswindow enableFlushWindow];
[nswindow flushWindow]; [nswindow flushWindow];
#endif
[nswindow release]; [nswindow release];
tmp_list = tmp_list->next; tmp_list = tmp_list->next;
@ -450,10 +459,12 @@ _gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
{ {
[NSAnimationContext beginGrouping]; [NSAnimationContext beginGrouping];
} }
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101100
else else
{ {
NSEnableScreenUpdates (); NSEnableScreenUpdates ();
} }
#endif
} }
static const gchar * static const gchar *