[gtk-osx] Patches for Gtk issues 1312 & 1411.
- From: John Ralls <jralls src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-osx] Patches for Gtk issues 1312 & 1411.
- Date: Mon, 15 Oct 2018 18:32:37 +0000 (UTC)
commit 5ae8c656a337c6c4e3d4c841cd8dce03f6c72da7
Author: John Ralls <jralls ceridwen us>
Date: Mon Oct 15 11:32:01 2018 -0700
Patches for Gtk issues 1312 & 1411.
modulesets-stable/gtk-osx.modules | 4 +
...dle-NULL-NSGraphicsContext-currentContext.patch | 100 +++++++++++++++++++++
...GDK_OSX-versions-to-current-MacOS-release.patch | 27 ++++++
...icsContext-CGContext-instead-of-graphicsP.patch | 30 +++++++
...do-not-cache-the-screen-in-the-gdkmonitor.patch | 75 ++++++++++++++++
5 files changed, 236 insertions(+)
---
diff --git a/modulesets-stable/gtk-osx.modules b/modulesets-stable/gtk-osx.modules
index b3d0beb..6f9df9b 100644
--- a/modulesets-stable/gtk-osx.modules
+++ b/modulesets-stable/gtk-osx.modules
@@ -230,6 +230,10 @@
autogenargs="--enable-quartz-backend --enable-quartz-relocation">
<branch module="gtk+/3.24/gtk+-3.24.1.tar.xz" version="3.24.1"
hash="sha256:68387be307b99aadcdc653561d7a2a7f0113b93561fb18ded7075ec9ced5b02f">
+ <patch
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Gtk3-24-1-quartz-do-not-cache-the-screen-in-the-gdkmonitor.patch"
strip="1"/>
+ <patch
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Gtk3-24-1-Update-GDK_OSX-versions-to-current-MacOS-release.patch"
strip="1"/>
+ <patch
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Gtk3-24-1-Use-NSGraphicsContext-CGContext-instead-of-graphicsP.patch"
strip="1"/>
+ <patch
file="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/patches/Gtk3-24-1-Handle-NULL-NSGraphicsContext-currentContext.patch"
strip="1"/>
</branch>
<dependencies>
<dep package="glib"/>
diff --git a/patches/Gtk3-24-1-Handle-NULL-NSGraphicsContext-currentContext.patch
b/patches/Gtk3-24-1-Handle-NULL-NSGraphicsContext-currentContext.patch
new file mode 100644
index 0000000..cb238ff
--- /dev/null
+++ b/patches/Gtk3-24-1-Handle-NULL-NSGraphicsContext-currentContext.patch
@@ -0,0 +1,100 @@
+From 4ae16f5a4f9d5e84ddae21401d79e4d58ea5cbdd Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls ceridwen us>
+Date: Mon, 15 Oct 2018 10:50:49 -0700
+Subject: [PATCH 3/3] Handle NULL NSGraphicsContext currentContext.
+
+Return NULL from gdk_window_impl_quartz_get_context immediately to avoid
+quartz errors and don't try to call cairo functions with the NULL in
+upstream functions.
+
+Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1411
+---
+ gdk/gdkcairo.c | 3 ++-
+ gdk/gdkwindow.c | 20 ++++++++++++--------
+ gdk/quartz/gdkwindow-quartz.c | 6 ++++--
+ 3 files changed, 18 insertions(+), 11 deletions(-)
+
+diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c
+index 633b391..a8df0d0 100644
+--- a/gdk/gdkcairo.c
++++ b/gdk/gdkcairo.c
+@@ -303,7 +303,8 @@ gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pixbuf,
+ gdk_pixbuf_get_height (pixbuf),
+ scale);
+
+- gdk_cairo_surface_paint_pixbuf (surface, pixbuf);
++ if (surface)
++ gdk_cairo_surface_paint_pixbuf (surface, pixbuf);
+
+ return surface;
+ }
+diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
+index 6b231f0..1244f87 100644
+--- a/gdk/gdkwindow.c
++++ b/gdk/gdkwindow.c
+@@ -10234,7 +10234,7 @@ gdk_window_create_similar_image_surface (GdkWindow * window,
+ int scale)
+ {
+ GdkWindowImplClass *impl_class;
+- cairo_surface_t *window_surface, *surface;
++ cairo_surface_t *window_surface, *surface = NULL;
+ GdkDisplay *display;
+ GdkScreen *screen;
+
+@@ -10254,18 +10254,22 @@ gdk_window_create_similar_image_surface (GdkWindow * window,
+ else
+ {
+ window_surface = gdk_window_ref_impl_surface (window);
+- surface =
+- cairo_surface_create_similar_image (window_surface,
+- format,
+- width,
+- height);
+- cairo_surface_destroy (window_surface);
++ if (window_surface)
++ {
++ surface =
++ cairo_surface_create_similar_image (window_surface,
++ format,
++ width,
++ height);
++ cairo_surface_destroy (window_surface);
++ }
+ }
+
+ if (scale == 0)
+ scale = gdk_window_get_scale_factor (window);
+
+- cairo_surface_set_device_scale (surface, scale, scale);
++ if (surface)
++ cairo_surface_set_device_scale (surface, scale, scale);
+
+ return surface;
+ }
+diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
+index c7fe688..2e7edd1 100644
+--- a/gdk/quartz/gdkwindow-quartz.c
++++ b/gdk/quartz/gdkwindow-quartz.c
+@@ -141,6 +141,8 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
+ cg_context = [[NSGraphicsContext currentContext] graphicsPort];
+ else
+ cg_context = [[NSGraphicsContext currentContext] CGContext];
++ if (!cg_context)
++ return NULL;
+ CGContextSaveGState (cg_context);
+ CGContextSetAllowsAntialiasing (cg_context, antialias);
+
+@@ -332,8 +334,8 @@ gdk_quartz_ref_cairo_surface (GdkWindow *window)
+ gdk_quartz_create_cairo_surface (impl,
+ gdk_window_get_width (impl->wrapper) * scale,
+ gdk_window_get_height (impl->wrapper) * scale);
+-
+- cairo_surface_set_device_scale (impl->cairo_surface, scale, scale);
++ if (impl->cairo_surface)
++ cairo_surface_set_device_scale (impl->cairo_surface, scale, scale);
+ }
+ else
+ cairo_surface_reference (impl->cairo_surface);
+--
+2.2.2
+
diff --git a/patches/Gtk3-24-1-Update-GDK_OSX-versions-to-current-MacOS-release.patch
b/patches/Gtk3-24-1-Update-GDK_OSX-versions-to-current-MacOS-release.patch
new file mode 100644
index 0000000..f7c323b
--- /dev/null
+++ b/patches/Gtk3-24-1-Update-GDK_OSX-versions-to-current-MacOS-release.patch
@@ -0,0 +1,27 @@
+From 1a7cfec5c3cc9330e155639b37617eac20ec5081 Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls ceridwen us>
+Date: Mon, 15 Oct 2018 10:41:15 -0700
+Subject: [PATCH 1/3] Update GDK_OSX versions to current MacOS release.
+
+---
+ gdk/quartz/gdkquartz.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
+index 24555d4..ed8e4cb 100644
+--- a/gdk/quartz/gdkquartz.h
++++ b/gdk/quartz/gdkquartz.h
+@@ -53,7 +53,9 @@ typedef enum
+ GDK_OSX_YOSEMITE = 10,
+ GDK_OSX_EL_CAPITAN = 11,
+ GDK_OSX_SIERRA = 12,
+- GDK_OSX_CURRENT = 12,
++ GDK_OSX_HIGH_SIERRA = 13,
++ GDK_OSX_MOJAVE = 14,
++ GDK_OSX_CURRENT = 14,
+ GDK_OSX_NEW = 99
+ } GdkOSXVersion;
+
+--
+2.2.2
+
diff --git a/patches/Gtk3-24-1-Use-NSGraphicsContext-CGContext-instead-of-graphicsP.patch
b/patches/Gtk3-24-1-Use-NSGraphicsContext-CGContext-instead-of-graphicsP.patch
new file mode 100644
index 0000000..6d37112
--- /dev/null
+++ b/patches/Gtk3-24-1-Use-NSGraphicsContext-CGContext-instead-of-graphicsP.patch
@@ -0,0 +1,30 @@
+From a929a826ee91329312484f8ad6eb6f1bd322462b Mon Sep 17 00:00:00 2001
+From: John Ralls <jralls ceridwen us>
+Date: Mon, 15 Oct 2018 10:45:57 -0700
+Subject: [PATCH 2/3] Use [NSGraphicsContext CGContext] instead of graphicsPort
+ after Yosemite.
+
+---
+ gdk/quartz/gdkwindow-quartz.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
+index 4ffbae0..c7fe688 100644
+--- a/gdk/quartz/gdkwindow-quartz.c
++++ b/gdk/quartz/gdkwindow-quartz.c
+@@ -137,8 +137,10 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
+ if (![window_impl->view lockFocusIfCanDraw])
+ return NULL;
+ }
+-
+- cg_context = [[NSGraphicsContext currentContext] graphicsPort];
++ if (gdk_quartz_osx_version () < GDK_OSX_YOSEMITE)
++ cg_context = [[NSGraphicsContext currentContext] graphicsPort];
++ else
++ cg_context = [[NSGraphicsContext currentContext] CGContext];
+ CGContextSaveGState (cg_context);
+ CGContextSetAllowsAntialiasing (cg_context, antialias);
+
+--
+2.2.2
+
diff --git a/patches/Gtk3-24-1-quartz-do-not-cache-the-screen-in-the-gdkmonitor.patch
b/patches/Gtk3-24-1-quartz-do-not-cache-the-screen-in-the-gdkmonitor.patch
new file mode 100644
index 0000000..082d0d1
--- /dev/null
+++ b/patches/Gtk3-24-1-quartz-do-not-cache-the-screen-in-the-gdkmonitor.patch
@@ -0,0 +1,75 @@
+From 2a392c220d992ba21b1e250be2497248658cfcdb Mon Sep 17 00:00:00 2001
+From: Ignacio Casal Quinteiro <qignacio amazon com>
+Date: Sun, 7 Oct 2018 21:51:35 +0200
+Subject: [PATCH] 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 ec36b23..b3e0343 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 448c483..468a1d8 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 2193388..f1feaed 100644
+--- a/gdk/quartz/gdkscreen-quartz.c
++++ b/gdk/quartz/gdkscreen-quartz.c
+@@ -156,7 +156,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];
+
+--
+2.2.2
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]