widget: Remove _gtk_widget_is_drawable()

Use _gtk_widget_get_mapped() instead.

Drawable checked visible && mapped and mapped widgets are always
visible, so that was an unnecessary check.
This commit is contained in:
Benjamin Otte 2020-02-04 17:31:18 +01:00
parent cc22987b1b
commit 3cb150abbe
3 changed files with 7 additions and 13 deletions

View File

@ -2587,7 +2587,7 @@ gtk_widget_unparent (GtkWidget *widget)
if (gtk_widget_get_focus_child (priv->parent) == widget)
gtk_widget_set_focus_child (priv->parent, NULL);
if (_gtk_widget_is_drawable (priv->parent))
if (_gtk_widget_get_mapped (priv->parent))
gtk_widget_queue_draw (priv->parent);
if (priv->visible && _gtk_widget_get_visible (priv->parent))
@ -4372,7 +4372,7 @@ gtk_widget_real_can_activate_accel (GtkWidget *widget,
/* widgets must be onscreen for accels to take effect */
return gtk_widget_is_sensitive (widget) &&
_gtk_widget_is_drawable (widget) &&
_gtk_widget_get_mapped (widget) &&
gdk_surface_is_viewable (priv->surface);
}
@ -10424,7 +10424,7 @@ gtk_widget_contains (GtkWidget *widget,
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (!_gtk_widget_is_drawable (widget))
if (!_gtk_widget_get_mapped (widget))
return FALSE;
return GTK_WIDGET_GET_CLASS (widget)->contains (widget, x, y);
@ -10435,7 +10435,7 @@ static gboolean
gtk_widget_can_be_picked (GtkWidget *widget,
GtkPickFlags flags)
{
if (!_gtk_widget_is_drawable (widget))
if (!_gtk_widget_get_mapped (widget))
return FALSE;
if (!(flags & GTK_PICK_NON_TARGETABLE) &&
@ -12205,7 +12205,7 @@ gtk_widget_snapshot (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (!_gtk_widget_is_drawable (widget))
if (!_gtk_widget_get_mapped (widget))
return;
if (_gtk_widget_get_alloc_needed (widget))

View File

@ -424,7 +424,7 @@ gtk_widget_focus_sort (GtkWidget *widget,
child = _gtk_widget_get_next_sibling (child))
{
if (_gtk_widget_get_realized (child) &&
_gtk_widget_is_drawable (child) &&
_gtk_widget_get_mapped (child) &&
gtk_widget_get_sensitive (child))
g_ptr_array_add (focus_order, child);
}
@ -475,7 +475,7 @@ gtk_widget_focus_move (GtkWidget *widget,
ret = gtk_widget_child_focus (child, direction);
}
}
else if (_gtk_widget_is_drawable (child) &&
else if (_gtk_widget_get_mapped (child) &&
gtk_widget_is_ancestor (child, widget))
{
ret = gtk_widget_child_focus (child, direction);

View File

@ -381,12 +381,6 @@ _gtk_widget_get_mapped (GtkWidget *widget)
return widget->priv->mapped;
}
static inline gboolean
_gtk_widget_is_drawable (GtkWidget *widget)
{
return widget->priv->visible && widget->priv->mapped;
}
static inline gboolean
_gtk_widget_get_realized (GtkWidget *widget)
{