[gtk/scroll-event-propagation: 361/362] quartz: do not cache the screen in the gdkmonitor
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/scroll-event-propagation: 361/362] quartz: do not cache the screen in the gdkmonitor
- Date: Wed, 17 Oct 2018 08:34:55 +0000 (UTC)
commit 7cdab90a5979483b9e30c8a69c8bc3d40c651a65
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Sun Oct 7 21:51:35 2018 +0200
quartz: do not cache the screen in the gdkmonitor
Instead we just cache the monitor number and get
out of it the nsscreen when it is needed. This is
a requirement since it nsscreen it is not supposed
to be cached.
Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1312
gdk/quartz/gdkmonitor-quartz.c | 17 ++++++++++++-----
gdk/quartz/gdkmonitor-quartz.h | 2 +-
gdk/quartz/gdkscreen-quartz.c | 2 +-
3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/gdk/quartz/gdkmonitor-quartz.c b/gdk/quartz/gdkmonitor-quartz.c
index 8130f2f6cc..b3e11f7d3e 100644
--- a/gdk/quartz/gdkmonitor-quartz.c
+++ b/gdk/quartz/gdkmonitor-quartz.c
@@ -35,12 +35,19 @@ gdk_quartz_monitor_get_workarea (GdkMonitor *monitor,
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->y = quartz_screen->height - (rect.origin.y + rect.size.height) + quartz_screen->min_y;
- dest->width = rect.size.width;
- dest->height = rect.size.height;
+ 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->width = rect.size.width;
+ dest->height = rect.size.height;
+ }
+ else
+ *dest = monitor->geometry;
GDK_QUARTZ_RELEASE_POOL;
}
diff --git a/gdk/quartz/gdkmonitor-quartz.h b/gdk/quartz/gdkmonitor-quartz.h
index 448c483f7a..468a1d8f96 100644
--- a/gdk/quartz/gdkmonitor-quartz.h
+++ b/gdk/quartz/gdkmonitor-quartz.h
@@ -30,7 +30,7 @@ struct _GdkQuartzMonitor
{
GdkMonitor parent;
- NSScreen *nsscreen;
+ gint monitor_num;
};
struct _GdkQuartzMonitorClass {
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index f8094354a0..303c603fcc 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -144,7 +144,7 @@ gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
"display", display,
NULL);
g_ptr_array_add (display_quartz->monitors, monitor);
- monitor->nsscreen = [array objectAtIndex:i];
+ monitor->monitor_num = i;
NSRect rect = [[array objectAtIndex:i] frame];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]