GNOME Bugzilla – Bug 676890
GtkButton are still highlighted after removing them from a container
Last modified: 2012-09-17 03:23:52 UTC
A button is highlighted if the private variable in_button is TRUE. This variable is set when the pointer is over the button and cleared when it left the button. When a button is hidden while there is the pointer over it, GTK generates a leave notification event and in_button is set to FALSE. But when a button is removed from a container but not destroyed, it is unrealized and loose its window. It cannot receive the leave notification event and in_button stay TRUE. Later when the button get a new parent and it shown again, it is still highlighted.
Created attachment 215052 [details] [review] Fix This patch fix the issue by setting in_button to FALSE when the button is unrealized.
As you set the version to 3.3: Do you really use an old unstable version?
(In reply to comment #2) > As you set the version to 3.3: Do you really use an old unstable version? No sorry, I haven't checked this field, I'm using the master branch.
Review of attachment 215052 [details] [review]: I'd probably do this in unmap instead of unrealize, and also set button_down to FALSE.
Created attachment 215067 [details] [review] Fix I have moved the reset of the in_button flag in the unmap function instead on unrealized. Clearing button_down here doesn't work, I think it's because it is not enough. button_down is cleared later when the widget is added to a new parent in the function gtk_button_screen_changed.
Review of attachment 215067 [details] [review]: Looks good to me