From 5af8f3cee25944c56066ec08d8c63ee7aafa257d Mon Sep 17 00:00:00 2001 From: Chris Angelico <rosuav@gmail.com> Date: Tue, 14 Mar 2017 10:02:59 +1100 Subject: [PATCH] Support GDK Quartz by probing for headers instead of assuming --- src/post_modules/GTK2/configure.in | 2 ++ src/post_modules/GTK2/pgtk.h | 10 ++++++++++ src/post_modules/GTK2/source/gdkdrawable.pre | 7 ------- src/post_modules/GTK2/source/gdkpixmap.pre | 6 ------ src/post_modules/GTK2/source/gdkwindow.pre | 7 ------- src/post_modules/GTK2/source/global.pre | 5 ----- src/post_modules/GTK2/source/gtksocket.pre | 8 -------- src/post_modules/GTK2/source/gtkwidget.pre | 5 ----- 8 files changed, 12 insertions(+), 38 deletions(-) diff --git a/src/post_modules/GTK2/configure.in b/src/post_modules/GTK2/configure.in index 218fe520be..fe0543954f 100644 --- a/src/post_modules/GTK2/configure.in +++ b/src/post_modules/GTK2/configure.in @@ -373,6 +373,8 @@ OLD_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" +AC_CHECK_HEADERS( gdk/gdkx.h gdk/gdkwin32.h gdk/gdkquartz.h ) + AC_CHECK_FUNCS(gtk_tree_selection_unselect_range g_value_get_schar g_value_set_schar) AC_MSG_CHECKING([if g_signal_connect_data takes six args]) diff --git a/src/post_modules/GTK2/pgtk.h b/src/post_modules/GTK2/pgtk.h index 5068a9119d..6bf62af3d3 100644 --- a/src/post_modules/GTK2/pgtk.h +++ b/src/post_modules/GTK2/pgtk.h @@ -52,6 +52,16 @@ #include <arpa/inet.h> #endif +#if defined(HAVE_GDK_GDKX_H) +#include <gdk/gdkx.h> +#elif defined(HAVE_GDK_GDKWIN32_H) +#include <gdk/gdkwin32.h> +#elif defined(HAVE_GDK_GDKQUARTZ_H) +#include <gdk/gdkquartz.h> +#else +#error Must have one of gdkx.h, gdkwin32.h, or gdkquartz.h available +#endif + /* #undef GTK_STYLE #define GTK_STYLE(X) ((GtkStyle *)X) diff --git a/src/post_modules/GTK2/source/gdkdrawable.pre b/src/post_modules/GTK2/source/gdkdrawable.pre index f127121476..4b4e6562ce 100644 --- a/src/post_modules/GTK2/source/gdkdrawable.pre +++ b/src/post_modules/GTK2/source/gdkdrawable.pre @@ -2,13 +2,6 @@ class GDK2.Drawable; inherit G.Object; -%{ -#ifndef __NT__ -#include <gdk/gdkx.h> -#else -#include <gdk/gdkwin32.h> -#endif -%} //! The GDK2.Bitmap, GDK2.Window and GDK2.Pixmap classes are all GDK drawables. //! <br /> //! This means that you can use the same set of functions to draw in them.<br /> diff --git a/src/post_modules/GTK2/source/gdkpixmap.pre b/src/post_modules/GTK2/source/gdkpixmap.pre index 9c30734531..8e8c940ccf 100644 --- a/src/post_modules/GTK2/source/gdkpixmap.pre +++ b/src/post_modules/GTK2/source/gdkpixmap.pre @@ -10,12 +10,6 @@ inherit GDK2.Drawable; //! //! NOIMG %{ -#ifdef __NT__ -#include <gdk/gdkwin32.h> -#else -#include <gdk/gdkx.h> -#endif - GdkImage *pgtk2_pixmap_setup(struct object *o, int *free) { if (get_gdkobject(o,image)) diff --git a/src/post_modules/GTK2/source/gdkwindow.pre b/src/post_modules/GTK2/source/gdkwindow.pre index 8530771729..0ba315cebd 100644 --- a/src/post_modules/GTK2/source/gdkwindow.pre +++ b/src/post_modules/GTK2/source/gdkwindow.pre @@ -2,13 +2,6 @@ class GDK2.Window; inherit GDK2.Drawable; -%{ -#ifndef __NT__ -#include <gdk/gdkx.h> -#else -#include <gdk/gdkwin32.h> -#endif -%} //! a GDK2.Window object. //! //! NOIMG diff --git a/src/post_modules/GTK2/source/global.pre b/src/post_modules/GTK2/source/global.pre index 67a3425be6..f784eed2cd 100644 --- a/src/post_modules/GTK2/source/global.pre +++ b/src/post_modules/GTK2/source/global.pre @@ -3,11 +3,6 @@ %{ #include <gdk/gdkprivate.h> -#ifndef __NT__ -#include <gdk/gdkx.h> -#else -#include <gdk/gdkwin32.h> -#endif /* The main stuff.. */ int pgtk2_is_setup = 0, pgnome2_is_setup = 0; diff --git a/src/post_modules/GTK2/source/gtksocket.pre b/src/post_modules/GTK2/source/gtksocket.pre index cc170aa5c3..d042ea9017 100644 --- a/src/post_modules/GTK2/source/gtksocket.pre +++ b/src/post_modules/GTK2/source/gtksocket.pre @@ -2,14 +2,6 @@ class GTK2.Socket; inherit GTK2.Container; -%{ -#ifndef __NT__ -#include <gdk/gdkx.h> -#else -#include <gdk/gdkwin32.h> -#endif -%} - //! Together with W(Plug), GTK2.Socket provides the ability to embed //! widgets from one process into another process in a fashion that is //! transparent to the user. One process creates a GTK2.Socket widget diff --git a/src/post_modules/GTK2/source/gtkwidget.pre b/src/post_modules/GTK2/source/gtkwidget.pre index df92947da7..d9ebd2be09 100644 --- a/src/post_modules/GTK2/source/gtkwidget.pre +++ b/src/post_modules/GTK2/source/gtkwidget.pre @@ -3,11 +3,6 @@ class GTK2.Widget; inherit GTK2.Object; %{ -#ifndef __NT__ -#include <gdk/gdkx.h> -#else -#include <gdk/gdkwin32.h> -#endif #undef TWIN #undef _GC #define TWIN (GTK_WIDGET(THIS->obj)->window) -- GitLab