[gtkhtml] Work around sudden disapperance of GdkRegion in GTK+ 2.90.5.



commit 194f434dd987b66a114b827d73ccb1d4b2c24b0a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Tue Jun 29 19:04:15 2010 -0400

    Work around sudden disapperance of GdkRegion in GTK+ 2.90.5.
    
    API was deprecated and removed in less than two hours!  Sheesh!

 gtkhtml/Makefile.am  |    1 +
 gtkhtml/gtk-compat.h |   25 +++++++++++++++++++++++++
 gtkhtml/htmlengine.c |    1 +
 3 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gtkhtml/Makefile.am b/gtkhtml/Makefile.am
index c2409d2..2f5b380 100644
--- a/gtkhtml/Makefile.am
+++ b/gtkhtml/Makefile.am
@@ -198,6 +198,7 @@ csources =					\
 	htmliframe.h				\
 	htmlframe.h				\
 	htmlframeset.h				\
+	gtk-compat.h				\
 	$(PLATFORM_DEP_SOURCES)			\
 	$(NULL)
 
diff --git a/gtkhtml/gtk-compat.h b/gtkhtml/gtk-compat.h
new file mode 100644
index 0000000..264d273
--- /dev/null
+++ b/gtkhtml/gtk-compat.h
@@ -0,0 +1,25 @@
+#ifndef __GTK_COMPAT_H__
+#define __GTK_COMPAT_H__
+
+#include <gtk/gtk.h>
+
+/* Provide a GTK+ compatibility layer. */
+
+#if GTK_CHECK_VERSION (2,90,5)
+
+/* Recreate GdkRegion until we drop GTK2 compatibility. */
+
+#define GdkRegion cairo_region_t
+
+#define gdk_region_new()		cairo_region_create()
+#define gdk_region_destroy(region)	cairo_region_destroy (region)
+
+#define gdk_region_union_with_rect(region, rect) \
+	G_STMT_START { \
+		if ((rect)->width > 0 && (rect)->height > 0) \
+			cairo_region_union_rectangle ((region), (rect)); \
+	} G_STMT_END
+
+#endif
+
+#endif /* __GTK_COMPAT_H__ */
diff --git a/gtkhtml/htmlengine.c b/gtkhtml/htmlengine.c
index f53d76c..fc65a30 100644
--- a/gtkhtml/htmlengine.c
+++ b/gtkhtml/htmlengine.c
@@ -27,6 +27,7 @@
    If `e->flow' is not NULL, it must contain something.  */
 
 #include <config.h>
+#include "gtk-compat.h"
 #include "gtkhtml-compat.h"
 
 #include <stdio.h>



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