forked from AuroraMiddleware/gtk
Avoid some more type checks for internal calls
This commit is contained in:
parent
68a27a9951
commit
7bee22bcb6
@ -496,7 +496,7 @@ gtk_box_size_allocate_no_center (GtkWidget *widget,
|
||||
if (nvis_children <= 0)
|
||||
return;
|
||||
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
direction = _gtk_widget_get_direction (widget);
|
||||
sizes = g_newa (GtkRequestedSize, nvis_children);
|
||||
spacing = get_spacing (box);
|
||||
|
||||
@ -837,7 +837,7 @@ gtk_box_size_allocate_with_center (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
direction = _gtk_widget_get_direction (widget);
|
||||
sizes[0] = g_newa (GtkRequestedSize, nvis[0]);
|
||||
sizes[1] = g_newa (GtkRequestedSize, nvis[1]);
|
||||
|
||||
@ -1377,7 +1377,7 @@ gtk_box_get_path_for_child (GtkContainer *container,
|
||||
/* get_children works in visible order */
|
||||
children = gtk_container_get_children (container);
|
||||
if (private->orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (box)) == GTK_TEXT_DIR_RTL)
|
||||
_gtk_widget_get_direction (GTK_WIDGET (box)) == GTK_TEXT_DIR_RTL)
|
||||
children = g_list_reverse (children);
|
||||
|
||||
for (list = children; list; list = list->next)
|
||||
@ -1445,7 +1445,7 @@ gtk_box_update_child_css_position (GtkBox *box,
|
||||
|
||||
reverse = child_info->pack == GTK_PACK_END;
|
||||
if (box->priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (box)) == GTK_TEXT_DIR_RTL)
|
||||
_gtk_widget_get_direction (GTK_WIDGET (box)) == GTK_TEXT_DIR_RTL)
|
||||
reverse = !reverse;
|
||||
|
||||
if (reverse)
|
||||
|
@ -724,7 +724,7 @@ gtk_frame_allocate (GtkCssGadget *gadget,
|
||||
gint nat_width, width, height;
|
||||
gfloat xalign;
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
xalign = priv->label_xalign;
|
||||
else
|
||||
xalign = 1 - priv->label_xalign;
|
||||
|
@ -1596,7 +1596,7 @@ gtk_grid_request_allocate_children (GtkGridRequest *request,
|
||||
child_allocation.width = MAX (1, width);
|
||||
child_allocation.height = MAX (1, height);
|
||||
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
|
||||
if (_gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = allocation->x + allocation->width
|
||||
- (child_allocation.x - allocation->x) - child_allocation.width;
|
||||
|
||||
|
@ -3518,7 +3518,7 @@ gtk_label_ensure_layout (GtkLabel *label)
|
||||
|
||||
widget = GTK_WIDGET (label);
|
||||
|
||||
rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
if (!priv->layout)
|
||||
{
|
||||
@ -3900,7 +3900,7 @@ get_layout_location (GtkLabel *label,
|
||||
xalign = priv->xalign;
|
||||
yalign = priv->yalign;
|
||||
|
||||
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||
if (_gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
|
||||
xalign = 1.0 - xalign;
|
||||
|
||||
pango_layout_get_extents (priv->layout, NULL, &logical);
|
||||
@ -4200,13 +4200,13 @@ gtk_label_render (GtkCssGadget *gadget,
|
||||
|
||||
gtk_label_ensure_layout (label);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
context = _gtk_widget_get_style_context (widget);
|
||||
|
||||
if (GTK_IS_ACCEL_LABEL (widget))
|
||||
{
|
||||
guint ac_width = gtk_accel_label_get_accel_width (GTK_ACCEL_LABEL (widget));
|
||||
width -= ac_width;
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
x += ac_width;
|
||||
}
|
||||
|
||||
@ -4514,7 +4514,7 @@ window_to_layout_coords (GtkLabel *label,
|
||||
|
||||
/* get layout location in widget->window coords */
|
||||
get_layout_location (label, &lx, &ly);
|
||||
gtk_widget_get_allocation (GTK_WIDGET (label), &allocation);
|
||||
_gtk_widget_get_allocation (GTK_WIDGET (label), &allocation);
|
||||
|
||||
*x += allocation.x; /* go to widget->window */
|
||||
*x -= lx; /* go to layout */
|
||||
@ -4533,7 +4533,7 @@ layout_to_window_coords (GtkLabel *label,
|
||||
|
||||
/* get layout location in widget->window coords */
|
||||
get_layout_location (label, &lx, &ly);
|
||||
gtk_widget_get_allocation (GTK_WIDGET (label), &allocation);
|
||||
_gtk_widget_get_allocation (GTK_WIDGET (label), &allocation);
|
||||
|
||||
*x += lx; /* go to widget->window */
|
||||
*x -= allocation.x; /* go to selection window */
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "gtkoverlay.h"
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
@ -342,7 +343,7 @@ gtk_overlay_get_child_position (GtkOverlay *overlay,
|
||||
alloc->x = main_alloc.x;
|
||||
alloc->width = MAX (min.width, MIN (main_alloc.width, req.width));
|
||||
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
direction = _gtk_widget_get_direction (widget);
|
||||
|
||||
halign = gtk_widget_get_halign (widget);
|
||||
switch (effective_align (halign, direction))
|
||||
|
@ -663,7 +663,7 @@ static GtkPositionType
|
||||
get_effective_position (GtkPopover *popover,
|
||||
GtkPositionType pos)
|
||||
{
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (popover)) == GTK_TEXT_DIR_RTL)
|
||||
if (_gtk_widget_get_direction (GTK_WIDGET (popover)) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
if (pos == GTK_POS_LEFT)
|
||||
pos = GTK_POS_RIGHT;
|
||||
@ -730,7 +730,7 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
|
||||
|
||||
get_margin (widget, &margin);
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
if (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
widget_margin.left = gtk_widget_get_margin_start (widget);
|
||||
widget_margin.right = gtk_widget_get_margin_end (widget);
|
||||
|
@ -485,7 +485,7 @@ update_scrollbar_positions (GtkScrolledWindow *scrolled_window)
|
||||
if (priv->vscrollbar != NULL)
|
||||
{
|
||||
context = gtk_widget_get_style_context (priv->vscrollbar);
|
||||
is_rtl = gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL;
|
||||
is_rtl = _gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL;
|
||||
if ((is_rtl &&
|
||||
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
||||
priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
|
||||
@ -3062,7 +3062,7 @@ gtk_scrolled_window_relative_allocation (GtkWidget *widget,
|
||||
{
|
||||
gboolean is_rtl;
|
||||
|
||||
is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
if ((!is_rtl &&
|
||||
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
||||
@ -3192,10 +3192,10 @@ gtk_scrolled_window_allocate_scrollbar (GtkScrolledWindow *scrolled_window,
|
||||
}
|
||||
else if (scrollbar == priv->vscrollbar)
|
||||
{
|
||||
if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
|
||||
if ((_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL &&
|
||||
(priv->window_placement == GTK_CORNER_TOP_RIGHT ||
|
||||
priv->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
|
||||
(gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR &&
|
||||
(_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR &&
|
||||
(priv->window_placement == GTK_CORNER_TOP_LEFT ||
|
||||
priv->window_placement == GTK_CORNER_BOTTOM_LEFT)))
|
||||
{
|
||||
@ -3496,7 +3496,7 @@ _gtk_scrolled_window_set_adjustment_value (GtkScrolledWindow *scrolled_window,
|
||||
|
||||
/* Invert horizontal edge position on RTL */
|
||||
if (!vertical &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL)
|
||||
_gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL)
|
||||
edge_pos = (edge_pos == GTK_POS_LEFT) ? GTK_POS_RIGHT : GTK_POS_LEFT;
|
||||
|
||||
g_signal_emit (scrolled_window, signals[EDGE_OVERSHOT], 0, edge_pos);
|
||||
@ -3743,7 +3743,7 @@ maybe_emit_edge_reached (GtkScrolledWindow *scrolled_window,
|
||||
return;
|
||||
|
||||
if (!vertical &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL)
|
||||
_gtk_widget_get_direction (GTK_WIDGET (scrolled_window)) == GTK_TEXT_DIR_RTL)
|
||||
edge_pos = (edge_pos == GTK_POS_LEFT) ? GTK_POS_RIGHT : GTK_POS_LEFT;
|
||||
|
||||
g_signal_emit (scrolled_window, signals[EDGE_REACHED], 0, edge_pos);
|
||||
|
@ -675,7 +675,7 @@ update_node_ordering (GtkSpinButton *spin_button)
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (spin_button)) == GTK_TEXT_DIR_LTR)
|
||||
if (_gtk_widget_get_direction (GTK_WIDGET (spin_button)) == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
down_button_pos = 1;
|
||||
up_button_pos = -1;
|
||||
|
@ -945,7 +945,7 @@ static GtkStackTransitionType
|
||||
effective_transition_type (GtkStack *stack,
|
||||
GtkStackTransitionType transition_type)
|
||||
{
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (stack)) == GTK_TEXT_DIR_RTL)
|
||||
if (_gtk_widget_get_direction (GTK_WIDGET (stack)) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
switch (transition_type)
|
||||
{
|
||||
|
@ -2466,7 +2466,7 @@ gtk_tree_view_calculate_width_before_expander (GtkTreeView *tree_view)
|
||||
GList *list;
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list->data != tree_view->priv->expander_column;
|
||||
list = (rtl ? list->prev : list->next))
|
||||
@ -2513,7 +2513,7 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
|
||||
if (first_column == NULL)
|
||||
return;
|
||||
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
/* find out how many extra space and expandable columns we have */
|
||||
for (list = tree_view->priv->columns; list != last_column->next; list = list->next)
|
||||
@ -2678,7 +2678,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
tree_view->priv->width));
|
||||
g_object_thaw_notify (G_OBJECT (tree_view->priv->hadjustment));
|
||||
|
||||
if (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
|
||||
if (_gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
if (allocation->width < tree_view->priv->width)
|
||||
{
|
||||
@ -2774,7 +2774,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
int size;
|
||||
GtkTextDirection direction;
|
||||
|
||||
direction = gtk_widget_get_direction (child->widget);
|
||||
direction = _gtk_widget_get_direction (child->widget);
|
||||
path = _gtk_tree_path_new_from_rbtree (child->tree, child->node);
|
||||
gtk_tree_view_get_cell_area (tree_view, path, child->column, &child_rect);
|
||||
child_rect.x += child->border.left;
|
||||
@ -2929,7 +2929,7 @@ gtk_tree_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
||||
GList *list;
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
gtk_tree_view_stop_editing (tree_view, FALSE);
|
||||
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
|
||||
|
||||
@ -3004,7 +3004,7 @@ gtk_tree_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
||||
background_area.x = 0;
|
||||
|
||||
/* Let the column have a chance at selecting it. */
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list; list = (rtl ? list->prev : list->next))
|
||||
{
|
||||
@ -4751,7 +4751,7 @@ gtk_tree_view_snapshot_grid_lines (GtkTreeView *tree_view,
|
||||
&& tree_view->priv->grid_lines != GTK_TREE_VIEW_GRID_LINES_BOTH)
|
||||
return;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
first = g_list_first (tree_view->priv->columns);
|
||||
last = g_list_last (tree_view->priv->columns);
|
||||
@ -4816,7 +4816,7 @@ gtk_tree_view_bin_snapshot (GtkWidget *widget,
|
||||
GtkStyleContext *context;
|
||||
gboolean parity;
|
||||
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
if (tree_view->priv->tree == NULL)
|
||||
@ -9193,7 +9193,7 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
|
||||
if (x2)
|
||||
*x2 = 0;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
total_width = 0;
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
@ -9240,7 +9240,7 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
|
||||
gint expander_size, expander_render_size;
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
expander_size = gtk_tree_view_get_expander_size (tree_view);
|
||||
expander_render_size = expander_size - (_TREE_VIEW_HORIZONTAL_SEPARATOR / 2);
|
||||
|
||||
@ -10013,7 +10013,7 @@ gtk_tree_view_snapshot_arrow (GtkTreeView *tree_view,
|
||||
|
||||
widget = GTK_WIDGET (tree_view);
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
if (! GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
|
||||
return;
|
||||
@ -10133,7 +10133,7 @@ gtk_tree_view_focus_to_cursor (GtkTreeView *tree_view)
|
||||
{
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
gtk_cell_area_focus (cell_area,
|
||||
rtl ? GTK_DIR_LEFT : GTK_DIR_RIGHT);
|
||||
}
|
||||
@ -13088,7 +13088,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
|
||||
gboolean rtl;
|
||||
gint width;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
rtl = (_gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list;
|
||||
list = (rtl ? list->prev : list->next))
|
||||
@ -13257,7 +13257,7 @@ gtk_tree_view_get_cell_area (GtkTreeView *tree_view,
|
||||
gint depth = gtk_tree_path_get_depth (path);
|
||||
gboolean rtl;
|
||||
|
||||
rtl = gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
|
||||
rtl = _gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
if (!rtl)
|
||||
rect->x += (depth - 1) * tree_view->priv->level_indentation;
|
||||
|
@ -215,7 +215,7 @@ viewport_set_adjustment_values (GtkViewport *viewport,
|
||||
|
||||
/* We clamp to the left in RTL mode */
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (viewport)) == GTK_TEXT_DIR_RTL)
|
||||
_gtk_widget_get_direction (GTK_WIDGET (viewport)) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
gdouble dist = gtk_adjustment_get_upper (adjustment)
|
||||
- value
|
||||
|
@ -15617,7 +15617,7 @@ gtk_widget_snapshot (GtkWidget *widget,
|
||||
if (GTK_DEBUG_CHECK (SNAPSHOT))
|
||||
gtk_snapshot_push (snapshot, TRUE, "%s<%p>", gtk_widget_get_name (widget), widget);
|
||||
|
||||
filter_value = _gtk_style_context_peek_property (gtk_widget_get_style_context (widget), GTK_CSS_PROPERTY_FILTER);
|
||||
filter_value = _gtk_style_context_peek_property (_gtk_widget_get_style_context (widget), GTK_CSS_PROPERTY_FILTER);
|
||||
gtk_css_filter_value_push_snapshot (filter_value, snapshot);
|
||||
|
||||
if (mode == RENDER_DRAW)
|
||||
@ -15869,8 +15869,6 @@ gtk_widget_snapshot_child (GtkWidget *widget,
|
||||
{
|
||||
int x, y;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
g_return_if_fail (_gtk_widget_get_parent (child) == widget);
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user