[gitg] Fixed compatibility with gtk+ < 2.24



commit 334974dbbf0b2f4a56917a459074f9ce91bcab19
Author: Jesse van den Kieboom <jesse vandenkieboom epfl ch>
Date:   Sun Mar 27 16:05:51 2011 +0200

    Fixed compatibility with gtk+ < 2.24

 gitg/Makefile.am        |    1 +
 gitg/gseal-gtk-compat.c |   21 +++++++++++++++++++++
 gitg/gseal-gtk-compat.h |    9 +++++++++
 3 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index 5aa8e35..8402dfe 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -55,6 +55,7 @@ gitg_SOURCES =				\
 	gitg-uri.c			\
 	gitg-utils.c			\
 	gitg-window.c			\
+	gseal-gtk-compat.c		\
 	$(NOINST_H_FILES)
 
 if BUILD_SPINNER
diff --git a/gitg/gseal-gtk-compat.c b/gitg/gseal-gtk-compat.c
new file mode 100644
index 0000000..3cbbce0
--- /dev/null
+++ b/gitg/gseal-gtk-compat.c
@@ -0,0 +1,21 @@
+#include "gseal-gtk-compat.h"
+
+#if !GTK_CHECK_VERSION (2, 24, 0)
+gint
+gitg_gseal_gtk_compat_window_get_width (GdkWindow *window)
+{
+	gint width;
+
+	gdk_drawable_get_size (GDK_DRAWABLE (window), &width, NULL);
+	return width;
+}
+
+gint
+gitg_gseal_gtk_compat_window_get_height (GdkWindow *window)
+{
+	gint height;
+
+	gdk_drawable_get_size (GDK_DRAWABLE (window), NULL, &height);
+	return height;
+}
+#endif
diff --git a/gitg/gseal-gtk-compat.h b/gitg/gseal-gtk-compat.h
index 27b6e4a..9f46364 100644
--- a/gitg/gseal-gtk-compat.h
+++ b/gitg/gseal-gtk-compat.h
@@ -21,8 +21,17 @@
 #ifndef GSEAL_GTK_COMPAT_H
 #define GSEAL_GTK_COMPAT_H
 
+#include <gtk/gtk.h>
+
 G_BEGIN_DECLS
 
+#if !GTK_CHECK_VERSION(2, 24, 0)
+gint gitg_gseal_gtk_compat_window_get_width  (GdkWindow *window);
+gint gitg_gseal_gtk_compat_window_get_height (GdkWindow *window);
+
+#define gdk_window_get_width(window) gitg_gseal_gtk_compat_window_get_width(window)
+#define gdk_window_get_height(window) gitg_gseal_gtk_compat_window_get_height(window)
+#endif /* GTK < 2.24.0 */
 #if !GTK_CHECK_VERSION (2, 22, 0)
 #define gdk_drag_context_list_targets(context)		((context)->targets)
 #endif /* GTK < 2.22.0 */



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