Introduce compat macros for region differences
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 15 Jul 2010 02:51:18 +0000 (22:51 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 15 Jul 2010 02:51:18 +0000 (22:51 -0400)
src/vte-gtk-compat.h
src/vte.c
src/vtedraw.h

index 64a5dfb..c7c930b 100644 (file)
 
 G_BEGIN_DECLS
 
+#if GTK_CHECK_VERSION (2, 90, 5)
+
+#define GdkRegion cairo_region_t
+#define VteRegionRectangle cairo_rectangle_int_t
+#define gdk_region_new() cairo_region_create()
+#define gdk_region_rectangle(r) cairo_region_create_rectangle(r)
+#define gdk_region_copy(r) cairo_region_copy(r)
+#define gdk_region_destroy cairo_region_destroy
+#define gdk_region_union_with_rect(r, rect) cairo_region_union_rectangle(r, rect)
+#define gdk_region_union(r, s) cairo_region_union(r, s)
+#define gdk_region_get_clipbox(r, rect) cairo_region_get_extents(r, rect)
+#define gdk_region_get_rectangles(r, rects, n_rects)                   \
+       do {                                                            \
+               int i;                                                  \
+                                                                       \
+               *(n_rects) = cairo_region_num_rectangles(r);            \
+               *(rects) = g_new(cairo_rectangle_int_t, *(n_rects));    \
+               for (i = 0; i < *(n_rects); i++)                        \
+                       cairo_region_get_rectangle ((r), i, &(*(rects))[i]); \
+       } while (0)
+
+#else
+
+#define VteRegionRectangle GdkRectangle
+
+#endif
+
 #if !GTK_CHECK_VERSION (2, 20, 0)
 #define gtk_widget_get_mapped(widget)                   (GTK_WIDGET_MAPPED ((widget)))
 #define gtk_widget_get_realized(widget)                 (GTK_WIDGET_REALIZED ((widget)))
index 79b8bc7..e006452 100644 (file)
--- a/src/vte.c
+++ b/src/vte.c
@@ -343,7 +343,7 @@ _vte_invalidate_cells(VteTerminal *terminal,
                      glong column_start, gint column_count,
                      glong row_start, gint row_count)
 {
-       GdkRectangle rect;
+       VteRegionRectangle rect;
        glong i;
 
        if (!column_count || !row_count) {
@@ -462,7 +462,7 @@ _vte_invalidate_region (VteTerminal *terminal,
 void
 _vte_invalidate_all(VteTerminal *terminal)
 {
-       GdkRectangle rect;
+       VteRegionRectangle rect;
        GtkAllocation allocation;
 
        g_assert(VTE_IS_TERMINAL(terminal));
@@ -10441,7 +10441,7 @@ vte_terminal_expand_region (VteTerminal *terminal, GdkRegion *region, const GdkR
        VteScreen *screen;
        int width, height;
        int row, col, row_stop, col_stop;
-       GdkRectangle rect;
+       VteRegionRectangle rect;
 
        screen = terminal->pvt->screen;
 
index ea2198b..4f65183 100644 (file)
@@ -27,6 +27,7 @@
 #include "vtebg.h"
 #include "vte.h"
 #include "vteunistr.h"
+#include "vte-gtk-compat.h"
 
 G_BEGIN_DECLS