From 23a7232661bbc2058a483c52394a200f1803a6b0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 18 Oct 2013 14:36:45 -0400 Subject: Add a couple of compatibility hacks for GTK+-2. In tree.c, if GTK_MAJOR_VERSION==2, I provide an implementation of GTK 3's gtk_widget_get_preferred_size() for GTK 2. In util.c, if GDK_WINDOWNING_X11 is defined, but GDK_IS_X11_DISPLAY() isn't, I define it to always return 1. --- src/tree.c | 9 +++++++++ src/util.c | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/tree.c b/src/tree.c index a8b324f..7f20b92 100644 --- a/src/tree.c +++ b/src/tree.c @@ -30,6 +30,15 @@ #include "zenity.h" #include "util.h" +#if GTK_MAJOR_VERSION == 2 +static void +gtk_widget_get_preferred_size (GtkWidget *widget, GtkRequisition *minimum_size, GtkRequisition *natural_size) +{ + gtk_widget_size_request(widget, natural_size); + gtk_widget_get_size_request(widget, &(minimum_size->width), &(minimum_size->height)); +} +#endif + #define MAX_ELEMENTS_BEFORE_SCROLLING 5 #define PRINT_HIDE_COLUMN_SEPARATOR "," diff --git a/src/util.c b/src/util.c index d63aeca..23ba3ab 100644 --- a/src/util.c +++ b/src/util.c @@ -45,6 +45,10 @@ #define ZENITY_ERROR_DEFAULT -1 #define ZENITY_EXTRA_DEFAULT 127 +#if defined(GDK_WINDOWING_X11) && !defined(GDK_IS_X11_DISPLAY) +#define GDK_IS_X11_DISPLAY(display) 1 +#endif + GtkBuilder* zenity_util_load_ui_file (const gchar *root_widget, ...) { -- cgit v1.2.3