[gimp/gimp-2-8] build/osx: add GTK+ patch to fix crash in imquartz



commit 0ff79b0b517268b5280bb349276584c1c85c6138
Author: Kristian Rietveld <kris loopnest org>
Date:   Mon Jul 18 22:31:20 2016 +0200

    build/osx: add GTK+ patch to fix crash in imquartz

 build/osx/gimp.modules                             |    3 +
 .../gtk2-quartz-fix-regression-in-imquartz.patch   |   51 ++++++++++++++++++++
 ...duce-gdk_quartz_window_is_quartz-function.patch |   45 +++++++++++++++++
 3 files changed, 99 insertions(+), 0 deletions(-)
---
diff --git a/build/osx/gimp.modules b/build/osx/gimp.modules
index b8083fd..71ecd98 100644
--- a/build/osx/gimp.modules
+++ b/build/osx/gimp.modules
@@ -261,6 +261,9 @@
                autogenargs="--with-gdktarget=quartz --enable-debug=yes --disable-gtk-doc 
--enable-quartz-relocation --without-x --with-xinput --enable-xinerama">
                <branch module="gtk+/2.24/gtk+-2.24.30.tar.xz" version="2.24.30">
                        <patch file="gtk2-quartz-handle-didMove-and-didResize-in-the-same-way.patch" 
strip="1" />
+                       <!-- Until https://bugzilla.gnome.org/show_bug.cgi?id=753992 is merged -->
+                       <patch file="gtk2-quartz-introduce-gdk_quartz_window_is_quartz-function.patch" 
strip="1" />
+                       <patch file="gtk2-quartz-fix-regression-in-imquartz.patch" strip="1" />
                </branch>
                <dependencies>
                        <dep package="glib" />
diff --git a/build/osx/patches/gtk2-quartz-fix-regression-in-imquartz.patch 
b/build/osx/patches/gtk2-quartz-fix-regression-in-imquartz.patch
new file mode 100644
index 0000000..0366f9d
--- /dev/null
+++ b/build/osx/patches/gtk2-quartz-fix-regression-in-imquartz.patch
@@ -0,0 +1,51 @@
+From c9d68d33c22c2f454dac3662bc20135422e0b762 Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris loopnest org>
+Date: Mon, 18 Jul 2016 22:00:48 +0200
+Subject: [PATCH 2/2] imquartz: fix regression introduced by commit 4ba1fb
+
+In the preceding fix, the checks involving GDK_IS_QUARTZ_WINDOW macros
+were left out. These checks are in fact crucial, because these functions
+are sometimes called with non-quartz functions as the original comments
+in the code do indicate. Therefore, reintroduce these checks. This
+fixes a crash in GIMP.
+---
+ modules/input/imquartz.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/modules/input/imquartz.c b/modules/input/imquartz.c
+index f6d8f0f..033b0dd 100644
+--- a/modules/input/imquartz.c
++++ b/modules/input/imquartz.c
+@@ -194,6 +194,9 @@ quartz_filter_keypress (GtkIMContext *context,
+   if (!qc->client_window)
+     return FALSE;
+ 
++  if (!gdk_quartz_window_is_quartz (qc->client_window))
++    return gtk_im_context_filter_keypress (qc->slave, event);
++
+   nsview = gdk_quartz_window_get_nsview (qc->client_window);
+   win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
+   GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
+@@ -243,6 +246,9 @@ discard_preedit (GtkIMContext *context)
+   if (!qc->client_window)
+     return;
+ 
++  if (!gdk_quartz_window_is_quartz (qc->client_window))
++    return;
++
+   NSView *nsview = gdk_quartz_window_get_nsview (qc->client_window);
+   if (!nsview)
+     return;
+@@ -313,6 +319,9 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
+   if (!qc->client_window)
+     return;
+ 
++  if (!gdk_quartz_window_is_quartz (qc->client_window))
++    return;
++
+   if (!qc->focused)
+     return;
+ 
+-- 
+1.9.5 (Apple Git-50.3)
+
diff --git a/build/osx/patches/gtk2-quartz-introduce-gdk_quartz_window_is_quartz-function.patch 
b/build/osx/patches/gtk2-quartz-introduce-gdk_quartz_window_is_quartz-function.patch
new file mode 100644
index 0000000..3a718d1
--- /dev/null
+++ b/build/osx/patches/gtk2-quartz-introduce-gdk_quartz_window_is_quartz-function.patch
@@ -0,0 +1,45 @@
+From d7aa7682d890669d131b646d812c21b5760054bf Mon Sep 17 00:00:00 2001
+From: Kristian Rietveld <kris loopnest org>
+Date: Mon, 18 Jul 2016 21:59:28 +0200
+Subject: [PATCH 1/2] quartz: introduce gdk_quartz_window_is_quartz function
+
+This function can be used to check whether a GdkWindow is a quartz
+window. It is equivalent to it's win32 counterpart. The function
+is necessary because the macro necessary for this check is private.
+---
+ gdk/quartz/gdkquartz.h        | 1 +
+ gdk/quartz/gdkwindow-quartz.c | 6 ++++++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
+index 3c42983..70155c0 100644
+--- a/gdk/quartz/gdkquartz.h
++++ b/gdk/quartz/gdkquartz.h
+@@ -52,6 +52,7 @@ typedef enum
+   GDK_OSX_NEW = 99
+ } GdkOSXVersion;
+ 
++gboolean  gdk_quartz_window_is_quartz                           (GdkWindow      *window);
+ NSWindow *gdk_quartz_window_get_nswindow                        (GdkWindow      *window);
+ NSView   *gdk_quartz_window_get_nsview                          (GdkWindow      *window);
+ NSImage  *gdk_quartz_pixbuf_to_ns_image_libgtk_only             (GdkPixbuf      *pixbuf);
+diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
+index a7ee444..90aaa19 100644
+--- a/gdk/quartz/gdkwindow-quartz.c
++++ b/gdk/quartz/gdkwindow-quartz.c
+@@ -57,6 +57,12 @@ static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
+ 
+ static void gdk_window_impl_iface_init (GdkWindowImplIface *iface);
+ 
++gboolean
++gdk_quartz_window_is_quartz (GdkWindow *window)
++{
++  return GDK_WINDOW_IS_QUARTZ (window);
++}
++
+ NSView *
+ gdk_quartz_window_get_nsview (GdkWindow *window)
+ {
+-- 
+1.9.5 (Apple Git-50.3)
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]