GNOME Bugzilla – Bug 719486
Visual issue in GtkButton when it has been disabled while hovering mouse pointer on it
Last modified: 2013-12-05 03:59:30 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.
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.