aboutsummaryrefslogtreecommitdiffstats
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
parentd3d5ea2602c97877c9e72c27494a3bb51156abb8 (diff)
downloadgsoc2013-evolution-fc3123dc43dbe510efbff54baf7278ed2e607553.tar.gz
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!
-rw-r--r--calendar/gui/e-day-view-main-item.c2
-rw-r--r--calendar/gui/e-week-view-event-item.c2
-rw-r--r--e-util/gtk-compat.h51
-rw-r--r--widgets/table/e-cell-text.c1
-rw-r--r--widgets/text/e-text.c1
5 files changed, 57 insertions, 0 deletions
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 5de9b76546..0229f51602 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -41,6 +41,8 @@
#include "comp-util.h"
#include "calendar-config.h"
+#include "e-util/gtk-compat.h"
+
#define E_DAY_VIEW_MAIN_ITEM_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_DAY_VIEW_MAIN_ITEM, EDayViewMainItemPrivate))
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index ae3fadfd59..4aa2cb065c 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -40,6 +40,8 @@
#include <text/e-text.h>
+#include "e-util/gtk-compat.h"
+
#define E_WEEK_VIEW_EVENT_ITEM_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_WEEK_VIEW_EVENT_ITEM, EWeekViewEventItemPrivate))
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__ */
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 077357c5d6..ae4b31d6b6 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -54,6 +54,7 @@
#include "e-util/e-util.h"
#include "misc/e-canvas.h"
#include "e-util/e-unicode.h"
+#include "e-util/gtk-compat.h"
#include "e-table.h"
#include "e-cell-text.h"
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 92fc67cbfa..bb55b87f4c 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -53,6 +53,7 @@
#include <glib/gi18n.h>
#include "e-util/e-text-event-processor-emacs-like.h"
#include "e-util/e-util.h"
+#include "e-util/gtk-compat.h"
#include "e-text.h"