From a953fd762ea9b2366cb082e061159b3ce2a01a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 19 Feb 2019 08:24:43 +0100 Subject: [PATCH] widget: Add typecheck-less _is_sensitive It adds up to a whopping 3% in gtk_widget_pick --- gtk/gtkwidget.c | 4 +--- gtk/gtkwidgetprivate.h | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 42e43a28f6..22895e8e86 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -6481,11 +6481,9 @@ gtk_widget_get_sensitive (GtkWidget *widget) gboolean gtk_widget_is_sensitive (GtkWidget *widget) { - GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget); - g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - return !(priv->state_flags & GTK_STATE_FLAG_INSENSITIVE); + return _gtk_widget_is_sensitive (widget); } diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 31356ae5a5..ad04290708 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -484,6 +484,12 @@ _gtk_widget_get_last_child (GtkWidget *widget) return widget->priv->last_child; } +static inline gboolean +_gtk_widget_is_sensitive (GtkWidget *widget) +{ + return !(widget->priv->state_flags & GTK_STATE_FLAG_INSENSITIVE); +} + G_END_DECLS #endif /* __GTK_WIDGET_PRIVATE_H__ */