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 736702 - GtkWindow event special logic ignores subclass handlers
GtkWindow event special logic ignores subclass handlers
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.12.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-09-15 22:02 UTC by Cosimo Cecchi
Modified: 2014-12-10 06:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.80 KB, patch)
2014-09-15 22:03 UTC, Cosimo Cecchi
accepted-commit_now Details | Review
gtkwindow: run ::event and specific handlers for EWMH action triggering events (1.41 KB, patch)
2014-09-16 20:19 UTC, Carlos Garnacho
committed Details | Review

Description Cosimo Cecchi 2014-09-15 22:02:54 UTC
GtkWindow has a special case to handle certain events before the regular event processing, to deal with GTK+ grabs somewhere else preventing interactions with e.g. popovers or modal dialogs (see commit 36abb4b829).

The special case will run GtkWindow's own implementation of the event handlers; this will break the case when a GtkWindow subclass overrides an event handler.

To fix the issue, grab the correct event handler from the object class instead.
Comment 1 Cosimo Cecchi 2014-09-15 22:03:17 UTC
Created attachment 286240 [details] [review]
patch
Comment 2 Cosimo Cecchi 2014-09-15 22:04:53 UTC
Note that this applies to 3.12, since the code in master uses gestures (I did not test whether this is still a problem).
Comment 3 Matthias Clasen 2014-09-16 00:13:41 UTC
Review of attachment 286240 [details] [review]:

makes sense
Comment 4 Carlos Garnacho 2014-09-16 20:18:40 UTC
I'm somewhat concerned that you can conceivably get GtkWindow handlers to run twice, one in the special case, and another time after bubbling. But that would involve somewhat misbehaving handlers that neither chain up consistently nor stop event propagation, so it's maybe not a big concern, plus it is somewhat tricky to protect against that.

I'm attaching a patch for master that actually exposes the same potential behavior.
Comment 5 Carlos Garnacho 2014-09-16 20:19:31 UTC
Created attachment 286323 [details] [review]
gtkwindow: run ::event and specific handlers for EWMH action triggering events

This gives an opportunity for implementations to handle these events
differently, instead of hardcoding the WM-triggering behavior.

gtk_window_event() only forwards events for WM management if the event
widget is not the window (ie. caught when bubbling), so is safe to be
called here without triggering gtk_window_handle_wm_event() twice.

This commit is an adaption to master of
https://bugzilla.gnome.org/show_bug.cgi?id=736702#c1 by Cosimo Cecchi.
Comment 6 Matthias Clasen 2014-09-23 00:58:01 UTC
Comment on attachment 286323 [details] [review]
gtkwindow: run ::event and specific handlers for EWMH action triggering events

Attachment 286323 [details] pushed as 6b7b55f - gtkwindow: run ::event and specific handlers for EWMH action triggering events
Comment 7 Christoph Reiter (lazka) 2014-10-02 18:22:44 UTC
Since the upgrade to 3.14.1 https://git.gnome.org/browse/gtk+/commit/?id=6b7b55f9b2 broke my context menus. They get shown for a split second and disappear again.

Removing the "return GDK_EVENT_STOP;" part fixes it.
Comment 8 Christoph Reiter (lazka) 2014-10-02 19:13:58 UTC
I was using gtk_widget_event() to forward events to another widget (triggering the menu there). Using gtk_main_do_event() instead seems to fix it.
Comment 9 Cosimo Cecchi 2014-12-10 06:34:02 UTC
All the patches here got committed, closing as FIXED.
If the problem mentioned by Christoph still applies to master, it should be addressed in another bug.