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 676890 - GtkButton are still highlighted after removing them from a container
GtkButton are still highlighted after removing them from a container
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-05-26 17:27 UTC by Sébastien Granjoux
Modified: 2012-09-17 03:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix (1.28 KB, patch)
2012-05-26 17:29 UTC, Sébastien Granjoux
needs-work Details | Review
Fix (1.30 KB, patch)
2012-05-26 20:51 UTC, Sébastien Granjoux
accepted-commit_now Details | Review

Description Sébastien Granjoux 2012-05-26 17:27:16 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.
Comment 1 Sébastien Granjoux 2012-05-26 17:29:44 UTC
Created attachment 215052 [details] [review]
Fix

This patch fix the issue by setting in_button to FALSE when the button is unrealized.
Comment 2 André Klapper 2012-05-26 17:54:12 UTC
As you set the version to 3.3: Do you really use an old unstable version?
Comment 3 Sébastien Granjoux 2012-05-26 19:03:42 UTC
(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.
Comment 4 Matthias Clasen 2012-05-26 20:06:15 UTC
Review of attachment 215052 [details] [review]:

I'd probably do this in unmap instead of unrealize, and also set button_down to FALSE.
Comment 5 Sébastien Granjoux 2012-05-26 20:51:06 UTC
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.
Comment 6 Cosimo Cecchi 2012-09-03 18:13:16 UTC
Review of attachment 215067 [details] [review]:

Looks good to me