quartz: avoid focus locking on Mojave and newer

Based on part of the MacPorts Big Sur performance patch for GIMP issue 5989.

The NSView focus-locking API is deprecated on newer macOS releases and can cause expensive redraw behaviour. Keep the old path for older macOS versions, but avoid lockFocusIfCanDraw/unlockFocus on Mojave and newer.
This commit is contained in:
Daemonratte 2026-05-13 09:27:16 +02:00
commit eebe1148c1
2 changed files with 4 additions and 2 deletions

View file

@ -893,7 +893,8 @@ gdk_quartz_drawable_release_context (GdkDrawable *drawable,
if (window_impl->in_paint_rect_count == 0)
{
_gdk_quartz_drawable_flush (drawable);
[window_impl->view unlockFocus];
if (gdk_quartz_osx_version () < GDK_OSX_MOJAVE)
[window_impl->view unlockFocus];
}
}
else if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable))

View file

@ -104,7 +104,8 @@ gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
* and for widgets that send fake expose events like the arrow
* buttons in spinbuttons or the position marker in rulers.
*/
if (window_impl->in_paint_rect_count == 0)
if (window_impl->in_paint_rect_count == 0 &&
gdk_quartz_osx_version () < GDK_OSX_MOJAVE)
{
if (![window_impl->view lockFocusIfCanDraw])
return NULL;