Commit ac198a3c authored by Matthias Clasen's avatar Matthias Clasen

Add a few more inlined getters

parent 65ec902d
......@@ -2196,9 +2196,8 @@ gtk_container_real_check_resize (GtkContainer *container)
GtkAllocation allocation;
GtkRequisition requisition;
gtk_widget_get_preferred_size (widget,
&requisition, NULL);
gtk_widget_get_allocation (widget, &allocation);
gtk_widget_get_preferred_size (widget, &requisition, NULL);
_gtk_widget_get_allocation (widget, &allocation);
if (requisition.width > allocation.width ||
requisition.height > allocation.height)
......@@ -2247,7 +2246,7 @@ gtk_container_resize_children (GtkContainer *container)
g_return_if_fail (GTK_IS_CONTAINER (container));
widget = GTK_WIDGET (container);
gtk_widget_get_allocation (widget, &allocation);
_gtk_widget_get_allocation (widget, &allocation);
gtk_widget_size_allocate (widget, &allocation);
gtk_widget_set_allocation (widget, &allocation);
......@@ -2716,11 +2715,11 @@ gtk_container_real_set_focus_child (GtkContainer *container,
gtk_widget_translate_coordinates (focus_child, priv->focus_child,
0, 0, &x, &y);
gtk_widget_get_allocation (priv->focus_child, &allocation);
_gtk_widget_get_allocation (priv->focus_child, &allocation);
x += allocation.x;
y += allocation.y;
gtk_widget_get_allocation (focus_child, &allocation);
_gtk_widget_get_allocation (focus_child, &allocation);
if (vadj)
gtk_adjustment_clamp_page (vadj, y, y + allocation.height);
......@@ -2832,8 +2831,8 @@ tab_compare (gconstpointer a,
GtkTextDirection text_direction = GPOINTER_TO_INT (data);
gint y1, y2;
gtk_widget_get_allocation ((GtkWidget *) child1, &child1_allocation);
gtk_widget_get_allocation ((GtkWidget *) child2, &child2_allocation);
_gtk_widget_get_allocation ((GtkWidget *) child1, &child1_allocation);
_gtk_widget_get_allocation ((GtkWidget *) child2, &child2_allocation);
y1 = child1_allocation.y + child1_allocation.height / 2;
y2 = child2_allocation.y + child2_allocation.height / 2;
......@@ -3049,7 +3048,7 @@ gtk_container_focus_sort_up_down (GtkContainer *container,
GtkWidget *widget = GTK_WIDGET (container);
GdkRectangle old_focus_rect;
gtk_widget_get_allocation (widget, &allocation);
_gtk_widget_get_allocation (widget, &allocation);
if (old_focus_coords (container, &old_focus_rect))
{
......@@ -3179,7 +3178,7 @@ gtk_container_focus_sort_left_right (GtkContainer *container,
GtkWidget *widget = GTK_WIDGET (container);
GdkRectangle old_focus_rect;
gtk_widget_get_allocation (widget, &allocation);
_gtk_widget_get_allocation (widget, &allocation);
if (old_focus_coords (container, &old_focus_rect))
{
......@@ -3615,7 +3614,7 @@ gtk_container_draw_forall (GtkWidget *widget,
info.window_depth = G_MAXINT;
if (_gtk_widget_get_has_window (widget))
{
window = gtk_widget_get_window (widget);
window = _gtk_widget_get_window (widget);
siblings = gdk_window_peek_children (gdk_window_get_parent (window));
info.window_depth = g_list_index (siblings, window);
}
......@@ -3690,7 +3689,7 @@ gtk_container_map (GtkWidget *widget)
NULL);
if (_gtk_widget_get_has_window (widget))
gdk_window_show (gtk_widget_get_window (widget));
gdk_window_show (_gtk_widget_get_window (widget));
}
static void
......@@ -3704,7 +3703,7 @@ gtk_container_unmap (GtkWidget *widget)
* window, e.g. a GtkSocket would)
*/
if (_gtk_widget_get_has_window (widget))
gdk_window_hide (gtk_widget_get_window (widget));
gdk_window_hide (_gtk_widget_get_window (widget));
gtk_container_forall (GTK_CONTAINER (widget),
(GtkCallback)gtk_widget_unmap,
......@@ -3727,8 +3726,8 @@ gtk_container_should_propagate_draw (GtkContainer *container,
*/
event = _gtk_cairo_get_event (cr);
if (event &&
(_gtk_widget_get_has_window (child) &&
gdk_window_has_native (gtk_widget_get_window (child))))
_gtk_widget_get_has_window (child) &&
gdk_window_has_native (_gtk_widget_get_window (child)))
return FALSE;
/* Never propagate to a child window when exposing a window
......@@ -3736,9 +3735,9 @@ gtk_container_should_propagate_draw (GtkContainer *container,
*/
event_window = _gtk_cairo_get_event_window (cr);
if (_gtk_widget_get_has_window (child))
child_in_window = gdk_window_get_parent (gtk_widget_get_window (child));
child_in_window = gdk_window_get_parent (_gtk_widget_get_window (child));
else
child_in_window = gtk_widget_get_window (child);
child_in_window = _gtk_widget_get_window (child);
if (event_window != NULL && child_in_window != event_window)
return FALSE;
......@@ -3793,7 +3792,7 @@ gtk_container_propagate_draw (GtkContainer *container,
/* translate coordinates. Ugly business, that. */
if (!_gtk_widget_get_has_window (GTK_WIDGET (container)))
{
gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
_gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
x = -allocation.x;
y = -allocation.y;
}
......@@ -3803,9 +3802,9 @@ gtk_container_propagate_draw (GtkContainer *container,
y = 0;
}
window = gtk_widget_get_window (GTK_WIDGET (container));
window = _gtk_widget_get_window (GTK_WIDGET (container));
for (w = gtk_widget_get_window (child); w && w != window; w = gdk_window_get_parent (w))
for (w = _gtk_widget_get_window (child); w && w != window; w = gdk_window_get_parent (w))
{
int wx, wy;
gdk_window_get_position (w, &wx, &wy);
......@@ -3821,7 +3820,7 @@ gtk_container_propagate_draw (GtkContainer *container,
if (!_gtk_widget_get_has_window (child))
{
gtk_widget_get_allocation (child, &allocation);
_gtk_widget_get_allocation (child, &allocation);
x += allocation.x;
y += allocation.y;
}
......
......@@ -3927,7 +3927,7 @@ gtk_widget_get_property (GObject *object,
g_value_set_string (value, g_object_get_qdata (object, quark_tooltip_markup));
break;
case PROP_WINDOW:
g_value_set_object (value, gtk_widget_get_window (widget));
g_value_set_object (value, _gtk_widget_get_window (widget));
break;
case PROP_DOUBLE_BUFFERED:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
......@@ -5038,14 +5038,14 @@ gtk_widget_set_device_enabled_internal (GtkWidget *widget,
{
GdkWindow *window;
window = gtk_widget_get_window (widget);
window = _gtk_widget_get_window (widget);
device_enable_foreach_window (window, &data);
}
else
{
GList *window_list;
window_list = gdk_window_peek_children (gtk_widget_get_window (widget));
window_list = gdk_window_peek_children (_gtk_widget_get_window (widget));
g_list_foreach (window_list, device_enable_foreach_window, &data);
}
......@@ -5661,7 +5661,7 @@ gtk_widget_get_frame_clock (GtkWidget *widget)
* reparenting windows and widgets.
*/
GtkWidget *toplevel = _gtk_widget_get_toplevel (widget);
GdkWindow *window = gtk_widget_get_window (toplevel);
GdkWindow *window = _gtk_widget_get_window (toplevel);
g_assert (window != NULL);
return gdk_window_get_frame_clock (window);
......@@ -7000,7 +7000,7 @@ _gtk_widget_draw (GtkWidget *widget,
if (push_group)
cairo_push_group (cr);
window = gtk_widget_get_window (widget);
window = _gtk_widget_get_window (widget);
if (_gtk_widget_get_has_window (widget))
{
/* The widget will be completely contained in its window, so just
......@@ -7421,7 +7421,7 @@ _gtk_widget_get_translation_to_window (GtkWidget *widget,
*y = 0;
}
widget_window = gtk_widget_get_window (widget);
widget_window = _gtk_widget_get_window (widget);
for (w = window; w && w != widget_window; w = gdk_window_get_parent (w))
{
......@@ -7921,7 +7921,7 @@ gtk_widget_intersect (GtkWidget *widget,
* cairo_region_intersect_rectangle() to get the same behavior.
*/
cairo_region_t *
gtk_widget_region_intersect (GtkWidget *widget,
gtk_widget_region_intersect (GtkWidget *widget,
const cairo_region_t *region)
{
GdkRectangle rect;
......@@ -7930,7 +7930,7 @@ gtk_widget_region_intersect (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (region != NULL, NULL);
gtk_widget_get_allocation (widget, &rect);
_gtk_widget_get_allocation (widget, &rect);
dest = cairo_region_create_rectangle (&rect);
......@@ -10773,7 +10773,7 @@ gtk_widget_get_scale_factor (GtkWidget *widget)
g_return_val_if_fail (GTK_IS_WIDGET (widget), 1);
if (_gtk_widget_get_realized (widget))
return gdk_window_get_scale_factor (gtk_widget_get_window (widget));
return gdk_window_get_scale_factor (_gtk_widget_get_window (widget));
toplevel = _gtk_widget_get_toplevel (widget);
if (toplevel && toplevel != widget)
......@@ -13585,8 +13585,8 @@ gtk_widget_queue_compute_expand (GtkWidget *widget)
* Returns: whether widget tree rooted here should be expanded
*/
gboolean
gtk_widget_compute_expand (GtkWidget *widget,
GtkOrientation orientation)
gtk_widget_compute_expand (GtkWidget *widget,
GtkOrientation orientation)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
......@@ -13597,13 +13597,9 @@ gtk_widget_compute_expand (GtkWidget *widget,
gtk_widget_update_computed_expand (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
return widget->priv->computed_hexpand;
}
return widget->priv->computed_hexpand;
else
{
return widget->priv->computed_vexpand;
}
return widget->priv->computed_vexpand;
}
static void
......@@ -15553,7 +15549,7 @@ _gtk_widget_set_simple_clip (GtkWidget *widget,
context = _gtk_widget_get_style_context (widget);
gtk_widget_get_allocation (widget, &allocation);
_gtk_widget_get_allocation (widget, &allocation);
_gtk_css_shadows_value_get_extents (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_BOX_SHADOW),
......@@ -16049,7 +16045,7 @@ _gtk_widget_set_has_focus (GtkWidget *widget,
*
* fevent->focus_change.type = GDK_FOCUS_CHANGE;
* fevent->focus_change.in = TRUE;
* fevent->focus_change.window = gtk_widget_get_window (widget);
* fevent->focus_change.window = _gtk_widget_get_window (widget);
* if (fevent->focus_change.window != NULL)
* g_object_ref (fevent->focus_change.window);
*
......
......@@ -382,6 +382,19 @@ _gtk_widget_peek_request_cache (GtkWidget *widget)
return &widget->priv->requests;
}
static inline GdkWindow *
_gtk_widget_get_window (GtkWidget *widget)
{
return widget->priv->window;
}
static inline void
_gtk_widget_get_allocation (GtkWidget *widget,
GtkAllocation *allocation)
{
*allocation = widget->priv->allocation;
}
G_END_DECLS
#endif /* __GTK_WIDGET_PRIVATE_H__ */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment