After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719486 - Visual issue in GtkButton when it has been disabled while hovering mouse pointer on it
Visual issue in GtkButton when it has been disabled while hovering mouse poin...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.8.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-11-28 12:00 UTC by Alexey Kosilin
Modified: 2013-12-05 03:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Corrects GtkButton behaviour when it's being disabled while mouse pointer is on it (414 bytes, patch)
2013-11-28 12:00 UTC, Alexey Kosilin
none Details | Review

Description Alexey Kosilin 2013-11-28 12:00:50 UTC
Created attachment 263016 [details] [review]
Corrects GtkButton behaviour when it's being disabled while mouse pointer is on it

How to reproduce:

1. Create window with simple push button
2. Run the program
3. Hover mouse on the button
4. Disable the button programmatically by using set_sensitive (false).

The button is drawn greyed out but in the way as the mouse is still on it (the flag GTK_STATE_FLAG_PRELIGHT is set).

The reason is that gtk_button_state_changed() event handler resets priv->in_button flag but the change is not affects widget's GTK_STATE_FLAG_PRELIGHT flag. As it's evident from the code (gtkbutton.c), GTK_STATE_FLAG_PRELIGHT flag depends on priv->in_button value that, in its turn, is tracked by several event handlers. But the gtk_button_state_changed() event handler only resets priv->in_button while the GTK_STATE_FLAG_PRELIGHT remains untouched in almost all cases.

The visual effects is not apparent in all GUI themes (e.g. everything appears absolutely correct in Fedora 19 with GNOME 3), but the effects are protuberant while using Windows 7 GUI theme (of course in Win7 environment).

All preceding is true also for actual version of Gtk - the gtk_button_state_changed() event handler looks the same as in Gtk+ 3.8.

The patch of the gtkbutton.c is attached. Please revise it and, if it's necessary, include the changes in upstream.
Comment 1 Matthias Clasen 2013-12-05 03:59:30 UTC
Should be fixed by this and preceding commits:

commit 9a0064c684f8b91963eb152d7708cd12d355b5c2
Author: Benjamin Otte <otte@redhat.com>
Date:   Mon Dec 2 21:24:30 2013 +0100

    button: Call the new function
    
    This simplifies a lot of code and doesn't require hacks setting
    in_button anymore.