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 695618 - When dynamically adding to and removing a button from an EventBox, the Button won't receive mouse press (or any other) signals.
When dynamically adding to and removing a button from an EventBox, the Button...
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: .General
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-03-11 11:45 UTC by Pouria Mellati
Modified: 2017-09-04 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A script to reproduce the bug. (1.13 KB, text/plain)
2013-03-11 11:45 UTC, Pouria Mellati
Details

Description Pouria Mellati 2013-03-11 11:45:44 UTC
Created attachment 238572 [details]
A script to reproduce the bug.

I've described the problem, including a code fragment that reproduces the error, in this SO question:

http://stackoverflow.com/questions/15277594/gtk3-dynamically-adding-to-and-removing-a-button-from-an-eventbox-button-wont

Even though in the description in the link above, I've used the python bindings, I think the problem is in Gtk in general, hence my filing this as a Gtk bug.

For your convenience, the script to reproduce the bug is also added as an attachment of this bug report.
Comment 1 Daniel Boles 2017-09-04 20:37:14 UTC
While removing the Fixed doesn't seem to solve this problem, having that there seems to get in the way of diagnosing it.

Anyway, I can replicate this with the given test case - even after adding the missing return values to the handlers (assuming PyGI mirrors GLib in needing those).

But I do have one thing to note: add a simple print to the start of your on_enter handler. Notice how it gets fired only once as you enter the window and hence the Fixed. But now hover over the Button. ::enter-notify-event is fired continuously! You clearly weren't expecting that, and it probably means the EventBox never gets to raise its window back, or similar.

possibly somewhat relevant: Bug 556006
Comment 2 Daniel Boles 2017-09-04 20:51:06 UTC
(In reply to Daniel Boles from comment #1)
> But now hover over the Button. ::enter-notify-event is
> fired continuously!

...as is ::leave-notify-event

It seems that adding/removing the Fixed child causes the EventBox to receive a new enter/leave-notify-event, since you enter it when you remove the Button and fall through to the EventBox.

Thus, you get stuck in a loop of adding/removing the Button to and from the Fixed, and it never gets to stick around long enough to receive input.

I've not figured out exactly how to fix this yet, but it ought to give you enough to go on. Basically, you really need to avoid causing an infinite loop of events like this.
Comment 3 Daniel Boles 2017-09-04 21:07:43 UTC
So, since we *want* the removal of a child widget to cause an enter-notify-event on the parent, the code is doing wrong things and confusing GTK+. Hopefully you can figure out a way to fix it, but I'm pretty certain it's not a bug in GTK+.