[gtk] widget: Add typecheck-less _is_sensitive



commit a953fd762ea9b2366cb082e061159b3ce2a01a21
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 19 08:24:43 2019 +0100

    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__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]