diff --git a/area_unix.go b/area_unix.go index 11d3b04..c55f425 100644 --- a/area_unix.go +++ b/area_unix.go @@ -10,12 +10,7 @@ import ( ) // #cgo pkg-config: gtk+-3.0 -// /* GTK+ 3.8 deprecates gtk_scrolled_window_add_with_viewport(); we need 3.4 miniimum though -// setting MIN_REQUIRED ensures nothing older; setting MAX_ALLOWED disallows newer functions - thanks to desrt in irc.gimp.net/#gtk+ -// TODO add this to the other files too */ -// #define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_4 -// #define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_4 -// #include +// #include "gtk_unix.h" // extern gboolean our_area_draw_callback(GtkWidget *, cairo_t *, gpointer); // extern gboolean our_area_button_press_event_callback(GtkWidget *, GdkEvent *, gpointer); // extern gboolean our_area_button_release_event_callback(GtkWidget *, GdkEvent *, gpointer); diff --git a/callbacks_unix.go b/callbacks_unix.go index c130d27..85eec5a 100644 --- a/callbacks_unix.go +++ b/callbacks_unix.go @@ -15,7 +15,7 @@ while we're at it the callback for our idle function will be handled here too */ // #cgo pkg-config: gtk+-3.0 -// #include +// #include "gtk_unix.h" // #include // extern gboolean our_window_delete_event_callback(GtkWidget *, GdkEvent *, gpointer); // extern gboolean our_window_configure_event_callback(GtkWidget *, GdkEvent *, gpointer); diff --git a/dialog_unix.go b/dialog_unix.go index 8564efd..510d9c5 100644 --- a/dialog_unix.go +++ b/dialog_unix.go @@ -10,7 +10,7 @@ import ( // #cgo pkg-config: gtk+-3.0 // #include -// #include +// #include "gtk_unix.h" // /* because cgo seems to choke on ... */ // /* TODO does NULL parent make the box application-global? docs are unclear */ // GtkWidget *gtkNewMsgBox(GtkMessageType type, GtkButtonsType buttons, char *title, char *text) { GtkWidget *k = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, type, buttons, "%s", (gchar *) title); gtk_message_dialog_format_secondary_text((GtkMessageDialog *) k, "%s", (gchar *) text); return k; } diff --git a/gtk_unix.h b/gtk_unix.h new file mode 100644 index 0000000..240ea61 --- /dev/null +++ b/gtk_unix.h @@ -0,0 +1,16 @@ +/* 16 march 2014 */ + +/* This header file is a convenience to ensure that the compatibility flags below are included in all Go files that include */ + +/* +MIN_REQUIRED signals that programs are expected to run on at least GTK+ 3 .4 and thus deprectation warnings for newer versions (such as gtk_scrolled_window_add_with_viewport() being deprecated in GTK+ 3.8) should be suppressed. +MAX_ALLOWED signals that programs will not use features introduced in newer versions of GTK+ and that the compiler should warn us if we slip. +Thanks to desrt in irc.gimp.net/#gtk+ +*/ +#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_4 +#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_4 + +/* TODO are there equivalent compatibility macros for the other components of GTK+? */ + +#include +/* TODO include too */ diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go index 39effe1..c7b409a 100644 --- a/gtkcalls_unix.go +++ b/gtkcalls_unix.go @@ -11,7 +11,7 @@ import ( // #cgo pkg-config: gtk+-3.0 // #include -// #include +// #include "gtk_unix.h" import "C" type ( diff --git a/gtkcasts_unix.go b/gtkcasts_unix.go index b459c46..b4fe95b 100644 --- a/gtkcasts_unix.go +++ b/gtkcasts_unix.go @@ -14,7 +14,7 @@ import ( // Listbox casts are stored in listbox_unix.go // #cgo pkg-config: gtk+-3.0 -// #include +// #include "gtk_unix.h" import "C" func fromgbool(b C.gboolean) bool { diff --git a/listbox_unix.go b/listbox_unix.go index 96db13c..fd9995e 100644 --- a/listbox_unix.go +++ b/listbox_unix.go @@ -30,7 +30,7 @@ and the GTK+ reference documentation. // #cgo pkg-config: gtk+-3.0 // #include -// #include +// #include "gtk_unix.h" // /* because cgo seems to choke on ... */ // void gtkTreeModelGet(GtkTreeModel *model, GtkTreeIter *iter, gchar **gs) // {