summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-23 23:27:15 +0200
committerBenjamin Otte <otte@redhat.com>2010-05-23 23:27:15 +0200
commit821dd33918d80a28a7e47a2aaa2aaaf100b51c1b (patch)
treefe876ddb5fbf08140a9e0def07326e40829d35c3 /gtk
parentdde9cf28820696c57c1249ca08e318222665987d (diff)
downloadgtk+-821dd33918d80a28a7e47a2aaa2aaaf100b51c1b.tar.gz
Deprecate the GdkRegion API
Includes fixing all callers to use the cairo region API instead. This is usually just replacing the function names, the only difference is gdk_region_get_rectangles() being replaced by cairo_region_num_rectangles() and cairo_region_get_rectangle() which required a bit more work. https://bugzilla.gnome.org/show_bug.cgi?id=613284
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkcontainer.c4
-rw-r--r--gtk/gtkiconview.c27
-rw-r--r--gtk/gtklabel.c10
-rw-r--r--gtk/gtktextdisplay.c12
-rw-r--r--gtk/gtktreeitem.c4
-rw-r--r--gtk/gtktreeview.c41
-rw-r--r--gtk/gtkwidget.c30
7 files changed, 63 insertions, 65 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 6bedc86e99..b2c03a33e7 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -2730,9 +2730,9 @@ gtk_container_propagate_expose (GtkContainer *container,
g_object_ref (child_event->expose.window);
child_event->expose.region = gtk_widget_region_intersect (child, event->region);
- if (!gdk_region_empty (child_event->expose.region))
+ if (!cairo_region_is_empty (child_event->expose.region))
{
- gdk_region_get_clipbox (child_event->expose.region, &child_event->expose.area);
+ cairo_region_get_extents (child_event->expose.region, &child_event->expose.area);
gtk_widget_send_expose (child, child_event);
}
gdk_event_free (child_event);
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index ebb63a12b0..755a8425d8 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1573,7 +1573,7 @@ gtk_icon_view_expose (GtkWidget *widget,
area.width = item->width;
area.height = item->height;
- if (gdk_region_rect_in (expose->region, &area) == GDK_OVERLAP_RECTANGLE_OUT)
+ if (cairo_region_contains_rectangle (expose->region, &area) == CAIRO_REGION_OVERLAP_OUT)
continue;
gtk_icon_view_paint_item (icon_view, cr, item, &expose->area,
@@ -1645,17 +1645,16 @@ gtk_icon_view_expose (GtkWidget *widget,
if (icon_view->priv->doing_rubberband)
{
- GdkRectangle *rectangles;
+ cairo_rectangle_int_t rectangle;
gint n_rectangles;
- gdk_region_get_rectangles (expose->region,
- &rectangles,
- &n_rectangles);
+ n_rectangles = cairo_region_num_rectangles (expose->region);
while (n_rectangles--)
- gtk_icon_view_paint_rubberband (icon_view, cr, &rectangles[n_rectangles]);
-
- g_free (rectangles);
+ {
+ cairo_region_get_rectangle (expose->region, n_rectangles--, &rectangle);
+ gtk_icon_view_paint_rubberband (icon_view, cr, &rectangle);
+ }
}
cairo_destroy (cr);
@@ -2334,8 +2333,8 @@ gtk_icon_view_update_rubberband (gpointer data)
new_area.width = ABS (x - icon_view->priv->rubberband_x1) + 1;
new_area.height = ABS (y - icon_view->priv->rubberband_y1) + 1;
- invalid_region = gdk_region_rectangle (&old_area);
- gdk_region_union_with_rect (invalid_region, &new_area);
+ invalid_region = cairo_region_create_rectangle (&old_area);
+ cairo_region_union_rectangle (invalid_region, &new_area);
gdk_rectangle_intersect (&old_area, &new_area, &common);
if (common.width > 2 && common.height > 2)
@@ -2348,15 +2347,15 @@ gtk_icon_view_update_rubberband (gpointer data)
common.width -= 2;
common.height -= 2;
- common_region = gdk_region_rectangle (&common);
+ common_region = cairo_region_create_rectangle (&common);
- gdk_region_subtract (invalid_region, common_region);
- gdk_region_destroy (common_region);
+ cairo_region_subtract (invalid_region, common_region);
+ cairo_region_destroy (common_region);
}
gdk_window_invalidate_region (icon_view->priv->bin_window, invalid_region, TRUE);
- gdk_region_destroy (invalid_region);
+ cairo_region_destroy (invalid_region);
icon_view->priv->rubberband_x2 = x;
icon_view->priv->rubberband_y2 = y;
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 10e5850c36..216e3004a8 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3597,7 +3597,7 @@ gtk_label_expose (GtkWidget *widget,
x, y,
range,
1);
- gdk_region_intersect (clip, event->region);
+ cairo_region_intersect (clip, event->region);
/* FIXME should use gtk_paint, but it can't use a clip
* region
@@ -3618,7 +3618,7 @@ gtk_label_expose (GtkWidget *widget,
&widget->style->base[state]);
gdk_gc_set_clip_region (widget->style->black_gc, NULL);
- gdk_region_destroy (clip);
+ cairo_region_destroy (clip);
}
else if (info)
{
@@ -3668,7 +3668,7 @@ gtk_label_expose (GtkWidget *widget,
gdk_color_free (visited_link_color);
gdk_gc_set_clip_region (widget->style->black_gc, NULL);
- gdk_region_destroy (clip);
+ cairo_region_destroy (clip);
}
if (focus_link && gtk_widget_has_focus (widget))
@@ -3680,13 +3680,13 @@ gtk_label_expose (GtkWidget *widget,
x, y,
range,
1);
- gdk_region_get_clipbox (clip, &rect);
+ cairo_region_get_extents (clip, &rect);
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
&event->area, widget, "label",
rect.x, rect.y, rect.width, rect.height);
- gdk_region_destroy (clip);
+ cairo_region_destroy (clip);
}
}
}
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 1b9a7f2ebc..136e55ab48 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -426,7 +426,7 @@ get_selected_clip (GtkTextRenderer *text_renderer,
{
gint *ranges;
gint n_ranges, i;
- GdkRegion *clip_region = gdk_region_new ();
+ GdkRegion *clip_region = cairo_region_create ();
GdkRegion *tmp_region;
pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges);
@@ -440,12 +440,12 @@ get_selected_clip (GtkTextRenderer *text_renderer,
rect.width = PANGO_PIXELS (ranges[2*i + 1]) - PANGO_PIXELS (ranges[2*i]);
rect.height = height;
- gdk_region_union_with_rect (clip_region, &rect);
+ cairo_region_union_rectangle (clip_region, &rect);
}
- tmp_region = gdk_region_rectangle (&text_renderer->clip_rect);
- gdk_region_intersect (clip_region, tmp_region);
- gdk_region_destroy (tmp_region);
+ tmp_region = cairo_region_create_rectangle (&text_renderer->clip_rect);
+ cairo_region_intersect (clip_region, tmp_region);
+ cairo_region_destroy (tmp_region);
g_free (ranges);
return clip_region;
@@ -612,7 +612,7 @@ render_para (GtkTextRenderer *text_renderer,
gdk_gc_set_clip_region (fg_gc, NULL);
gdk_pango_renderer_set_gc (GDK_PANGO_RENDERER (text_renderer), fg_gc);
- gdk_region_destroy (clip_region);
+ cairo_region_destroy (clip_region);
/* Paint in the ends of the line */
if (line_rect.x > line_display->left_margin * PANGO_SCALE &&
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index a6ca505ffe..2fbe502ad9 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -691,9 +691,9 @@ gtk_tree_item_expose_child (GtkWidget *child,
child_event->expose.region = gtk_widget_region_intersect (child,
data->event->region);
- if (!gdk_region_empty (child_event->expose.region))
+ if (!cairo_region_is_empty (child_event->expose.region))
{
- gdk_region_get_clipbox (child_event->expose.region, &child_event->expose.area);
+ cairo_region_get_extents (child_event->expose.region, &child_event->expose.area);
gtk_widget_send_expose (child, child_event);
}
gdk_event_free (child_event);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 9a24472094..afac49e422 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4027,8 +4027,8 @@ gtk_tree_view_update_rubber_band (GtkTreeView *tree_view)
new_area.width = ABS (x - tree_view->priv->press_start_x) + 1;
new_area.height = ABS (y - tree_view->priv->press_start_y) + 1;
- invalid_region = gdk_region_rectangle (&old_area);
- gdk_region_union_with_rect (invalid_region, &new_area);
+ invalid_region = cairo_region_create_rectangle (&old_area);
+ cairo_region_union_rectangle (invalid_region, &new_area);
gdk_rectangle_intersect (&old_area, &new_area, &common);
if (common.width > 2 && common.height > 2)
@@ -4041,15 +4041,15 @@ gtk_tree_view_update_rubber_band (GtkTreeView *tree_view)
common.width -= 2;
common.height -= 2;
- common_region = gdk_region_rectangle (&common);
+ common_region = cairo_region_create_rectangle (&common);
- gdk_region_subtract (invalid_region, common_region);
- gdk_region_destroy (common_region);
+ cairo_region_subtract (invalid_region, common_region);
+ cairo_region_destroy (common_region);
}
gdk_window_invalidate_region (tree_view->priv->bin_window, invalid_region, TRUE);
- gdk_region_destroy (invalid_region);
+ cairo_region_destroy (invalid_region);
tree_view->priv->rubber_band_x = x;
tree_view->priv->rubber_band_y = y;
@@ -4515,7 +4515,7 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
cell_area.height -= grid_line_width;
}
- if (gdk_region_rect_in (event->region, &background_area) == GDK_OVERLAP_RECTANGLE_OUT)
+ if (cairo_region_contains_rectangle (event->region, &background_area) == CAIRO_REGION_OVERLAP_OUT)
{
cell_offset += column->width;
continue;
@@ -4986,20 +4986,19 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
done:
gtk_tree_view_draw_grid_lines (tree_view, event, n_visible_columns);
- if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
- {
- GdkRectangle *rectangles;
- gint n_rectangles;
-
- gdk_region_get_rectangles (event->region,
- &rectangles,
- &n_rectangles);
-
- while (n_rectangles--)
- gtk_tree_view_paint_rubber_band (tree_view, &rectangles[n_rectangles]);
-
- g_free (rectangles);
- }
+ if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
+ {
+ GdkRectangle rectangle;
+ gint n_rectangles;
+
+ n_rectangles = cairo_region_num_rectangles (event->region);
+
+ while (n_rectangles--)
+ {
+ cairo_region_get_rectangle (event->region, n_rectangles, &rectangle);
+ gtk_tree_view_paint_rubber_band (tree_view, &rectangle);
+ }
+ }
if (cursor_path)
gtk_tree_path_free (cursor_path);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 5d660f50d1..6eeac7afb8 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3937,7 +3937,7 @@ gtk_widget_invalidate_widget_windows (GtkWidget *widget,
int x, y;
gdk_window_get_position (widget->window, &x, &y);
- gdk_region_offset (region, -x, -y);
+ cairo_region_translate (region, -x, -y);
}
gdk_window_invalidate_maybe_recurse (widget->window, region,
@@ -3976,9 +3976,9 @@ gtk_widget_queue_shallow_draw (GtkWidget *widget)
rect.y += wy;
}
- region = gdk_region_rectangle (&rect);
+ region = cairo_region_create_rectangle (&rect);
gtk_widget_invalidate_widget_windows (widget, region);
- gdk_region_destroy (region);
+ cairo_region_destroy (region);
}
/**
@@ -4066,11 +4066,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
{
/* Invalidate union(old_allaction,widget->allocation) in widget->window
*/
- GdkRegion *invalidate = gdk_region_rectangle (&widget->allocation);
- gdk_region_union_with_rect (invalidate, &old_allocation);
+ GdkRegion *invalidate = cairo_region_create_rectangle (&widget->allocation);
+ cairo_region_union_rectangle (invalidate, &old_allocation);
gdk_window_invalidate_region (widget->window, invalidate, FALSE);
- gdk_region_destroy (invalidate);
+ cairo_region_destroy (invalidate);
}
if (size_changed)
@@ -4079,11 +4079,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
{
/* Invalidate union(old_allaction,widget->allocation) in widget->window and descendents owned by widget
*/
- GdkRegion *invalidate = gdk_region_rectangle (&widget->allocation);
- gdk_region_union_with_rect (invalidate, &old_allocation);
+ GdkRegion *invalidate = cairo_region_create_rectangle (&widget->allocation);
+ cairo_region_union_rectangle (invalidate, &old_allocation);
gtk_widget_invalidate_widget_windows (widget, invalidate);
- gdk_region_destroy (invalidate);
+ cairo_region_destroy (invalidate);
}
}
}
@@ -4091,9 +4091,9 @@ gtk_widget_size_allocate (GtkWidget *widget,
if ((size_changed || position_changed) && widget->parent &&
gtk_widget_get_realized (widget->parent) && GTK_CONTAINER (widget->parent)->reallocate_redraws)
{
- GdkRegion *invalidate = gdk_region_rectangle (&widget->parent->allocation);
+ GdkRegion *invalidate = cairo_region_create_rectangle (&widget->parent->allocation);
gtk_widget_invalidate_widget_windows (widget->parent, invalidate);
- gdk_region_destroy (invalidate);
+ cairo_region_destroy (invalidate);
}
}
@@ -5212,7 +5212,7 @@ gtk_widget_intersect (GtkWidget *widget,
* widgets with their own window.
*
* Computes the intersection of a @widget's area and @region, returning
- * the intersection. The result may be empty, use gdk_region_empty() to
+ * the intersection. The result may be empty, use cairo_region_is_empty() to
* check.
**/
GdkRegion *
@@ -5227,9 +5227,9 @@ gtk_widget_region_intersect (GtkWidget *widget,
gtk_widget_get_draw_rectangle (widget, &rect);
- dest = gdk_region_rectangle (&rect);
+ dest = cairo_region_create_rectangle (&rect);
- gdk_region_intersect (dest, region);
+ cairo_region_intersect (dest, region);
return dest;
}
@@ -9530,7 +9530,7 @@ expose_window (GdkWindow *window)
gdk_drawable_get_size (GDK_DRAWABLE (window),
&event.expose.area.width,
&event.expose.area.height);
- event.expose.region = gdk_region_rectangle (&event.expose.area);
+ event.expose.region = cairo_region_create_rectangle (&event.expose.area);
/* If this is not double buffered, force a double buffer so that
redirection works. */