Merge branch 'fix-crash-osx' into 'gtk-3-24'

quartz: do not cache the screen in the gdkmonitor

See merge request GNOME/gtk!375
This commit is contained in:
Ignacio Casal Quinteiro 2018-10-11 20:45:49 +00:00
commit 247b38eb42
3 changed files with 14 additions and 7 deletions

View File

@ -35,12 +35,19 @@ gdk_quartz_monitor_get_workarea (GdkMonitor *monitor,
GDK_QUARTZ_ALLOC_POOL; GDK_QUARTZ_ALLOC_POOL;
NSRect rect = [quartz_monitor->nsscreen visibleFrame]; NSArray *array = [NSScreen screens];
if (quartz_monitor->monitor_num < [array count])
{
NSScreen *screen = [array objectAtIndex:quartz_monitor->monitor_num];
NSRect rect = [screen visibleFrame];
dest->x = rect.origin.x - quartz_screen->min_x; dest->x = rect.origin.x - quartz_screen->min_x;
dest->y = quartz_screen->height - (rect.origin.y + rect.size.height) + quartz_screen->min_y; dest->y = quartz_screen->height - (rect.origin.y + rect.size.height) + quartz_screen->min_y;
dest->width = rect.size.width; dest->width = rect.size.width;
dest->height = rect.size.height; dest->height = rect.size.height;
}
else
*dest = monitor->geometry;
GDK_QUARTZ_RELEASE_POOL; GDK_QUARTZ_RELEASE_POOL;
} }

View File

@ -30,7 +30,7 @@ struct _GdkQuartzMonitor
{ {
GdkMonitor parent; GdkMonitor parent;
NSScreen *nsscreen; gint monitor_num;
}; };
struct _GdkQuartzMonitorClass { struct _GdkQuartzMonitorClass {

View File

@ -156,7 +156,7 @@ gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
"display", display, "display", display,
NULL); NULL);
g_ptr_array_add (display_quartz->monitors, monitor); g_ptr_array_add (display_quartz->monitors, monitor);
monitor->nsscreen = [array objectAtIndex:i]; monitor->monitor_num = i;
NSRect rect = [[array objectAtIndex:i] frame]; NSRect rect = [[array objectAtIndex:i] frame];