[gnome-games] aisleriot: gtk-3.0 build fixes
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] aisleriot: gtk-3.0 build fixes
- Date: Fri, 2 Jul 2010 21:07:46 +0000 (UTC)
commit 7bb23ba93d9db9d766e0d3837d8253c57609dc00
Author: Christian Persch <chpe gnome org>
Date: Fri Jul 2 23:07:16 2010 +0200
aisleriot: gtk-3.0 build fixes
Replace GdkRegion by cairo_region_t etc.
aisleriot/board-noclutter.c | 54 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 49 insertions(+), 5 deletions(-)
---
diff --git a/aisleriot/board-noclutter.c b/aisleriot/board-noclutter.c
index 2ea5681..8fb91c2 100644
--- a/aisleriot/board-noclutter.c
+++ b/aisleriot/board-noclutter.c
@@ -3035,8 +3035,15 @@ aisleriot_board_expose_event (GtkWidget *widget,
{
AisleriotBoard *board = AISLERIOT_BOARD (widget);
AisleriotBoardPrivate *priv = board->priv;
+#if GTK_CHECK_VERSION (2, 90, 5)
+ cairo_region_t *region = event->region;
+ cairo_rectangle_int_t rect_;
+ cairo_rectangle_int_t *rect = &rect_;
+#else
GdkRegion *region = event->region;
GdkRectangle *rects;
+ GdkRectangle *rect;
+#endif
int i, n_rects;
GPtrArray *slots;
guint n_slots;
@@ -3055,12 +3062,21 @@ aisleriot_board_expose_event (GtkWidget *widget,
if (event->window != window)
return FALSE;
+#if GTK_CHECK_VERSION (2, 90, 5)
+ if (cairo_region_is_empty (region))
+ return FALSE;
+#else
if (gdk_region_empty (region))
return FALSE;
-
+#endif
+
/* First paint the background */
+#if GTK_CHECK_VERSION (2, 90, 5)
+ n_rects = cairo_region_num_rectangles (region);
+#else
gdk_region_get_rectangles (region, &rects, &n_rects);
+#endif
if (n_rects == 0)
return FALSE;
@@ -3076,11 +3092,18 @@ aisleriot_board_expose_event (GtkWidget *widget,
#endif
for (i = 0; i < n_rects; ++i) {
+#if GTK_CHECK_VERSION (2, 90, 5)
+ cairo_region_get_rectangle (region, i, rect);
+#else
+ rect = &rects[i];
+#endif
gdk_draw_rectangle (window, priv->bg_gc, TRUE,
- rects[i].x, rects[i].y,
- rects[i].width, rects[i].height);
+ rect->x, rect->y,
+ rect->width, rect->height);
}
+#if !GTK_CHECK_VERSION (2, 90, 5)
g_free (rects);
+#endif
/* Only draw the the cards when the geometry is set, and we're in a resize */
if (!priv->geometry_set)
@@ -3100,9 +3123,14 @@ aisleriot_board_expose_event (GtkWidget *widget,
ArSlot *slot = slots->pdata[i];
/* Check whether this slot needs to be drawn */
+#if GTK_CHECK_VERSION (2, 90, 5)
+ if (cairo_region_contains_rectangle (region, &slot->rect) == CAIRO_REGION_OVERLAP_OUT)
+ continue;
+#else
if (gdk_region_rect_in (region, &slot->rect) == GDK_OVERLAP_RECTANGLE_OUT)
continue;
-
+#endif
+
exposed_slots[n_exposed_slots++] = slot;
}
@@ -3187,8 +3215,13 @@ aisleriot_board_expose_event (GtkWidget *widget,
* with the rect of the part of the card that's not going
* to be obscured by later drawn cards anyway.
*/
+#if GTK_CHECK_VERSION (2, 90, 5)
+ if (cairo_region_contains_rectangle (region, &card_rect) == CAIRO_REGION_OVERLAP_OUT)
+ goto next;
+#else
if (gdk_region_rect_in (region, &card_rect) == GDK_OVERLAP_RECTANGLE_OUT)
goto next;
+#endif
if (PIXBUF_DRAWING_LIKELIHOOD (use_pixbuf_drawing)) {
GdkPixbuf *pixbuf;
@@ -3221,8 +3254,14 @@ aisleriot_board_expose_event (GtkWidget *widget,
}
/* Draw the revealed card */
+#if GTK_CHECK_VERSION (2, 90, 5)
if (priv->show_card_slot != NULL &&
- gdk_region_rect_in (region, &priv->show_card_slot->rect) != GDK_OVERLAP_RECTANGLE_OUT) {
+ cairo_region_contains_rectangle (region, &priv->show_card_slot->rect) != CAIRO_REGION_OVERLAP_OUT)
+#else
+ if (priv->show_card_slot != NULL &&
+ gdk_region_rect_in (region, &priv->show_card_slot->rect) != GDK_OVERLAP_RECTANGLE_OUT)
+#endif
+ {
GdkRectangle card_rect;
get_rect_by_slot_and_card (board,
@@ -3263,8 +3302,13 @@ draw_focus:
GdkRectangle focus_rect;
/* Check whether this needs to be drawn */
+#if GTK_CHECK_VERSION (2, 90, 5)
+ if (cairo_region_contains_rectangle (region, &priv->focus_rect) == CAIRO_REGION_OVERLAP_OUT)
+ goto expose_done;
+#else
if (gdk_region_rect_in (region, &priv->focus_rect) == GDK_OVERLAP_RECTANGLE_OUT)
goto expose_done;
+#endif
if (ar_style_get_interior_focus (priv->style)) {
focus_rect = priv->focus_rect;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]