[gtk+] Remove all gtk_widget_get_content_size usages
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Remove all gtk_widget_get_content_size usages
- Date: Wed, 6 Dec 2017 06:53:19 +0000 (UTC)
commit 1aa811ce12497783dfe4beb06ce8cbe54e2a98bf
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 6 07:56:12 2017 +0100
Remove all gtk_widget_get_content_size usages
And remove the function itself. Make everything use gtk_widget_get_width
and gtk_widget_get_height instead.
gtk/gtkcellview.c | 3 ++-
gtk/gtkcombobox.c | 4 ++--
gtk/gtkdrawingarea.c | 4 +++-
gtk/gtkflowbox.c | 3 ++-
gtk/gtkiconview.c | 28 +++++++++++++++++-----------
gtk/gtkstack.c | 22 ++++++++++------------
gtk/gtktoolpalette.c | 10 +++++-----
gtk/gtktreeview.c | 14 +++++++-------
gtk/gtkwidget.c | 23 -----------------------
gtk/gtkwidgetprivate.h | 3 ---
gtk/gtkwindow.c | 3 ++-
11 files changed, 50 insertions(+), 67 deletions(-)
---
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 7397515..10b2c6d 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -657,7 +657,8 @@ gtk_cell_view_snapshot (GtkWidget *widget,
/* render cells */
area.x = 0;
area.y = 0;
- gtk_widget_get_content_size (widget, &area.width, &area.height);
+ area.width = gtk_widget_get_width (widget);
+ area.height = gtk_widget_get_height (widget);
/* set cell data (if available) */
if (cellview->priv->displayed_row)
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 304e33d..c7f834d 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1415,9 +1415,9 @@ gtk_combo_box_menu_popup (GtkComboBox *combo_box)
if (priv->wrap_width == 0)
{
- int width, height, min_width, nat_width;
+ int width, min_width, nat_width;
- gtk_widget_get_content_size (GTK_WIDGET (combo_box), &width, &height);
+ width = gtk_widget_get_width (GTK_WIDGET (combo_box));
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
gtk_widget_measure (priv->popup_widget, GTK_ORIENTATION_HORIZONTAL, -1,
&min_width, &nat_width, NULL, NULL);
diff --git a/gtk/gtkdrawingarea.c b/gtk/gtkdrawingarea.c
index e3af7b5..6e7ba54 100644
--- a/gtk/gtkdrawingarea.c
+++ b/gtk/gtkdrawingarea.c
@@ -242,7 +242,9 @@ gtk_drawing_area_snapshot (GtkWidget *widget,
if (!priv->draw_func)
return;
- gtk_widget_get_content_size (widget, &width, &height);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
+
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 95f89ca..e8205bd 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2326,9 +2326,10 @@ gtk_flow_box_snapshot (GtkWidget *widget,
GTK_WIDGET_CLASS (gtk_flow_box_parent_class)->snapshot (widget, snapshot);
- gtk_widget_get_content_size (widget, &width, &height);
x = 0;
y = 0;
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
if (priv->rubberband_first && priv->rubberband_last)
{
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 70e9359..72bc79f 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1677,7 +1677,8 @@ gtk_icon_view_snapshot (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
- gtk_widget_get_content_size (widget, &width, &height);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
gtk_snapshot_push_clip (snapshot,
&GRAPHENE_RECT_INIT (
0, 0,
@@ -1814,7 +1815,7 @@ gtk_icon_view_motion (GtkWidget *widget,
if (icon_view->priv->doing_rubberband)
{
- int width, height;
+ int height;
gtk_icon_view_update_rubberband (icon_view);
abs_y = icon_view->priv->mouse_y - icon_view->priv->height *
@@ -1822,7 +1823,8 @@ gtk_icon_view_motion (GtkWidget *widget,
(gtk_adjustment_get_upper (icon_view->priv->vadjustment) -
gtk_adjustment_get_lower (icon_view->priv->vadjustment)));
- gtk_widget_get_content_size (widget, &width, &height);
+ height = gtk_widget_get_height (widget);
+
if (abs_y < 0 || abs_y > height)
{
@@ -2608,7 +2610,7 @@ gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view)
static void
gtk_icon_view_set_hadjustment_values (GtkIconView *icon_view)
{
- int width, height;
+ int width;
GtkAdjustment *adj = icon_view->priv->hadjustment;
gdouble old_page_size;
gdouble old_upper;
@@ -2616,7 +2618,7 @@ gtk_icon_view_set_hadjustment_values (GtkIconView *icon_view)
gdouble new_value;
gdouble new_upper;
- gtk_widget_get_content_size (GTK_WIDGET (icon_view), &width, &height);
+ width = gtk_widget_get_width (GTK_WIDGET (icon_view));
old_value = gtk_adjustment_get_value (adj);
old_upper = gtk_adjustment_get_upper (adj);
@@ -2654,10 +2656,10 @@ gtk_icon_view_set_hadjustment_values (GtkIconView *icon_view)
static void
gtk_icon_view_set_vadjustment_values (GtkIconView *icon_view)
{
- int width, height;
+ int height;
GtkAdjustment *adj = icon_view->priv->vadjustment;
- gtk_widget_get_content_size (GTK_WIDGET (icon_view), &width, &height);
+ height = gtk_widget_get_height (GTK_WIDGET (icon_view));
gtk_adjustment_configure (adj,
gtk_adjustment_get_value (adj),
@@ -2769,7 +2771,8 @@ gtk_icon_view_layout (GtkIconView *icon_view)
rtl = gtk_widget_get_direction (GTK_WIDGET (icon_view)) == GTK_TEXT_DIR_RTL;
n_items = gtk_icon_view_get_n_items (icon_view);
- gtk_widget_get_content_size (widget, &width, &height);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
gtk_icon_view_compute_n_items_for_size (icon_view,
GTK_ORIENTATION_HORIZONTAL,
@@ -4018,7 +4021,8 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
x =0;
y =0;
- gtk_widget_get_content_size (widget, &width, &height);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
offset = y + item_area.y - row_align * (height - item_area.height);
@@ -4051,7 +4055,8 @@ gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
item_area.width = item->cell_area.width + priv->item_padding * 2;
item_area.height = item->cell_area.height + priv->item_padding * 2;
- gtk_widget_get_content_size (widget, &widget_width, &widget_height);
+ widget_width = gtk_widget_get_width (widget);
+ widget_height = gtk_widget_get_height (widget);
hadj = icon_view->priv->hadjustment;
vadj = icon_view->priv->vadjustment;
@@ -5953,7 +5958,8 @@ gtk_icon_view_autoscroll (GtkIconView *icon_view)
px = icon_view->priv->event_last_x;
py = icon_view->priv->event_last_y;
- gtk_widget_get_content_size (GTK_WIDGET (icon_view), &width, &height);
+ width = gtk_widget_get_width (GTK_WIDGET (icon_view));
+ height = gtk_widget_get_height (GTK_WIDGET (icon_view));
/* see if we are near the edge. */
voffset = py - 2 * SCROLL_EDGE_SIZE;
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index 59d427e..74c681d 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -735,10 +735,10 @@ static gint
get_bin_window_x (GtkStack *stack)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- int width, height;
+ int width;
int x = 0;
- gtk_widget_get_content_size (GTK_WIDGET (stack), &width, &height);
+ width = gtk_widget_get_width (GTK_WIDGET (stack));
if (gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER)
{
@@ -755,10 +755,10 @@ static gint
get_bin_window_y (GtkStack *stack)
{
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- int width, height;
+ int height;
int y = 0;
- gtk_widget_get_content_size (GTK_WIDGET (stack), &width, &height);
+ height = gtk_widget_get_height (GTK_WIDGET (stack));
if (gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER)
{
@@ -1871,10 +1871,9 @@ gtk_stack_snapshot_under (GtkWidget *widget,
gint x, y, width, height, pos_x, pos_y;
- gtk_widget_get_content_size (widget, &widget_width, &widget_height);
x = y = 0;
- width = widget_width;
- height = widget_height;
+ width = widget_width = gtk_widget_get_width (widget);
+ height = widget_height = gtk_widget_get_height (widget);
pos_x = pos_y = 0;
@@ -1939,7 +1938,8 @@ gtk_stack_snapshot_slide (GtkWidget *widget,
int x, y;
int width, height;
- gtk_widget_get_content_size (widget, &width, &height);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
x = get_bin_window_x (stack);
y = get_bin_window_y (stack);
@@ -1999,8 +1999,6 @@ gtk_stack_snapshot (GtkWidget *widget,
{
if (gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER)
{
- int width, height;
-
if (priv->last_visible_node == NULL &&
priv->last_visible_child != NULL)
{
@@ -2017,11 +2015,11 @@ gtk_stack_snapshot (GtkWidget *widget,
priv->last_visible_node = gtk_snapshot_finish (&last_visible_snapshot);
}
- gtk_widget_get_content_size (widget, &width, &height);
gtk_snapshot_push_clip (snapshot,
&GRAPHENE_RECT_INIT(
0, 0,
- width, height
+ gtk_widget_get_width (widget),
+ gtk_widget_get_height (widget)
),
"StackAnimationClip");
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 242397e..65e97d9 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -818,12 +818,12 @@ static void
gtk_tool_palette_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
- int width, height;
-
- gtk_widget_get_content_size (widget, &width, &height);
-
gtk_snapshot_push_clip (snapshot,
- &GRAPHENE_RECT_INIT(0, 0, width, height), "ToolPalette Clip");
+ &GRAPHENE_RECT_INIT(
+ 0, 0,
+ gtk_widget_get_width (widget),
+ gtk_widget_get_height (widget)
+ ), "ToolPalette Clip");
GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->snapshot (widget, snapshot);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 40771cd..fcc849b 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4490,10 +4490,10 @@ snapshot_empty (GtkTreeView *tree_view,
if (gtk_widget_has_visible_focus (widget))
{
- int width, height;
-
- gtk_widget_get_content_size (widget, &width, &height);
- gtk_snapshot_render_focus (snapshot, context, 0, 0, width, height);
+ gtk_snapshot_render_focus (snapshot, context,
+ 0, 0,
+ gtk_widget_get_width (widget),
+ gtk_widget_get_height (widget));
}
}
@@ -4662,7 +4662,8 @@ gtk_tree_view_bin_snapshot (GtkWidget *widget,
return;
}
- gtk_widget_get_content_size (GTK_WIDGET (tree_view), &bin_window_width, &bin_window_height);
+ bin_window_width = gtk_widget_get_width (GTK_WIDGET (tree_view));
+ bin_window_height = gtk_widget_get_height(GTK_WIDGET (tree_view));
clip = (GdkRectangle) { 0, 0, bin_window_width, bin_window_height };
new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, clip.y);
@@ -13885,7 +13886,6 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
gint x = 1, y = 1;
cairo_surface_t *surface;
gint bin_window_width;
- gint bin_window_height;
gboolean is_separator = FALSE;
gboolean rtl;
cairo_t *cr;
@@ -13922,7 +13922,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
background_area.y = y;
background_area.height = gtk_tree_view_get_row_height (tree_view, node);
- gtk_widget_get_content_size (GTK_WIDGET (tree_view), &bin_window_width, &bin_window_height);
+ bin_window_width = gtk_widget_get_width (GTK_WIDGET (tree_view));
surface = gdk_window_create_similar_surface (gtk_widget_get_window (GTK_WIDGET (tree_view)),
CAIRO_CONTENT_COLOR,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 23d9c2f..83d38ef 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -13059,29 +13059,6 @@ gtk_widget_get_own_allocation (GtkWidget *widget,
allocation->height = priv->allocation.height -margin.top - margin.bottom;
}
-void
-gtk_widget_get_content_size (GtkWidget *widget,
- int *width,
- int *height)
-{
- GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
- GtkBorder margin, border, padding;
- GtkCssStyle *style;
-
- style = gtk_css_node_get_style (priv->cssnode);
- get_box_margin (style, &margin);
- get_box_border (style, &border);
- get_box_padding (style, &padding);
-
- *width = priv->allocation.width;
- *height = priv->allocation.height;
-
- *width -= margin.left + border.left + padding.left +
- margin.right + border.right + padding.right;
- *height -= margin.top + border.top + padding.top +
- margin.bottom + border.bottom + padding.bottom;
-}
-
/**
* gtk_widget_get_allocated_width:
* @widget: the widget to query
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index e528e8a..da80377 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -315,9 +315,6 @@ void gtk_widget_get_outer_allocation (GtkWidget *wi
GtkAllocation *allocation);
void gtk_widget_get_own_allocation (GtkWidget *widget,
GtkAllocation *allocation);
-void gtk_widget_get_content_size (GtkWidget *widget,
- int *width,
- int *height);
void gtk_widget_get_window_allocation (GtkWidget *widget,
GtkAllocation *allocation);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2af3e50..3650734 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -9153,7 +9153,8 @@ gtk_window_snapshot (GtkWidget *widget,
context = gtk_widget_get_style_context (widget);
get_shadow_width (GTK_WINDOW (widget), &window_border);
- gtk_widget_get_content_size (widget, &width, &height);
+ width = gtk_widget_get_width (widget);
+ height = gtk_widget_get_height (widget);
if (priv->client_decorated &&
priv->decorated &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]