aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-30 08:37:25 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-30 08:38:29 +0800
commitfc3123dc43dbe510efbff54baf7278ed2e607553 (patch)
treeb614721c4a00722c82dae1cc9711306dee0c963d /e-util
parentd3d5ea2602c97877c9e72c27494a3bb51156abb8 (diff)
downloadgsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar
gsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar.gz
gsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar.bz2
gsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar.lz
gsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar.xz
gsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar.zst
gsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.zip
Work around sudden disappearance of GdkRegion in GTK+ 2.90.5.
API was deprecated and removed in less than two hours! Sheesh!
Diffstat (limited to 'e-util')
-rw-r--r--e-util/gtk-compat.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/e-util/gtk-compat.h b/e-util/gtk-compat.h
index 6b93eed320..b01b8c5e19 100644
--- a/e-util/gtk-compat.h
+++ b/e-util/gtk-compat.h
@@ -24,4 +24,55 @@
#define gdk_drag_context_get_selected_action(context) gdk_drag_context_get_action(context)
#endif
+#if GTK_CHECK_VERSION (2,90,5)
+
+/* Recreate GdkRegion until we drop GTK2 compatibility. */
+
+typedef enum {
+ GDK_OVERLAP_RECTANGLE_IN,
+ GDK_OVERLAP_RECTANGLE_OUT,
+ GDK_OVERLAP_RECTANGLE_PART
+} GdkOverlapType;
+
+#define GdkRegion cairo_region_t
+
+#define gdk_region_new() \
+ (cairo_region_create ())
+
+#define gdk_region_destroy(region) \
+ (cairo_region_destroy (region))
+
+#define gdk_region_intersect(source1, source2) \
+ (cairo_region_intersect ((source1), (source2)))
+
+#define gdk_region_rect_in(region, rectangle) \
+ (cairo_region_contains_rectangle ((region), (rectangle)))
+
+#define gdk_region_rectangle(rectangle) \
+ (((rectangle)->width <= 0 || (rectangle)->height <= 0) ? \
+ cairo_region_create () : cairo_region_create_rectangle (rectangle))
+
+#define gdk_region_get_rectangles(region, rectangles, n_rectangles) \
+ G_STMT_START { \
+ GdkRectangle *__rects; \
+ gint __i, __n; \
+ \
+ __n = cairo_region_num_rectangles (region); \
+ __rects = g_new (GdkRectangle, __n); \
+ \
+ for (__i = 0; __i < __n; __i++) \
+ cairo_region_get_rectangle ((region), __i, &__rects[__i]); \
+ \
+ *(n_rectangles) = __n; \
+ *(rectangles) = __rects; \
+ } G_STMT_END
+
+#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__ */