[vte] Introduce compat macros for region differences
- From: Kristian Høgsberg <krh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] Introduce compat macros for region differences
- Date: Thu, 15 Jul 2010 13:59:39 +0000 (UTC)
commit 235461a3c4ac1577a3c0891a2d0ca5316e12a568
Author: Kristian Høgsberg <krh bitplanet net>
Date: Wed Jul 14 22:51:18 2010 -0400
Introduce compat macros for region differences
src/vte-gtk-compat.h | 27 +++++++++++++++++++++++++++
src/vte.c | 6 +++---
src/vtedraw.h | 1 +
3 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/src/vte-gtk-compat.h b/src/vte-gtk-compat.h
index 64a5dfb..c7c930b 100644
--- a/src/vte-gtk-compat.h
+++ b/src/vte-gtk-compat.h
@@ -23,6 +23,33 @@
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)))
diff --git a/src/vte.c b/src/vte.c
index 79b8bc7..e006452 100644
--- 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;
diff --git a/src/vtedraw.h b/src/vtedraw.h
index ea2198b..4f65183 100644
--- a/src/vtedraw.h
+++ b/src/vtedraw.h
@@ -27,6 +27,7 @@
#include "vtebg.h"
#include "vte.h"
#include "vteunistr.h"
+#include "vte-gtk-compat.h"
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]