[gtk+] button: Allow :hover on insensitive buttons



commit b6f9ce8a73eeae696f15386d10477488624c66a3
Author: Benjamin Otte <otte redhat com>
Date:   Sat Dec 7 01:29:56 2013 +0100

    button: Allow :hover on insensitive buttons
    
    You can still hover a mouse on insensitive elements; it's up to the
    theme to disable that.
    This is in line with the HTML/CSS interpretation of :hover.
    
    Insensitive elements still cannot be clicked.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719486

 gtk/gtkbutton.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 6bcf197..7486a73 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -2044,8 +2044,7 @@ gtk_button_leave_notify (GtkWidget        *widget,
   GtkButtonPrivate *priv = button->priv;
 
   if ((event->window == button->priv->event_window) &&
-      (event->detail != GDK_NOTIFY_INFERIOR) &&
-      (gtk_widget_get_sensitive (widget)))
+      (event->detail != GDK_NOTIFY_INFERIOR))
     {
       priv->in_button = FALSE;
       g_signal_emit (button, button_signals[LEAVE], 0);
@@ -2104,8 +2103,9 @@ static void
 gtk_real_button_released (GtkButton *button)
 {
   gtk_button_do_release (button,
-                         button->priv->in_button ||
-                         touch_release_in_button (button));
+                         gtk_widget_is_sensitive (GTK_WIDGET (button)) &&
+                         (button->priv->in_button ||
+                          touch_release_in_button (button)));
 }
 
 static void 
@@ -2703,13 +2703,9 @@ gtk_button_state_changed (GtkWidget    *widget,
                           GtkStateType  previous_state)
 {
   GtkButton *button = GTK_BUTTON (widget);
-  GtkButtonPrivate *priv = button->priv;
 
   if (!gtk_widget_is_sensitive (widget))
-    {
-      priv->in_button = FALSE;
-      gtk_button_do_release (button, FALSE);
-    }
+    gtk_button_do_release (button, FALSE);
 }
 
 static void


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