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 670881 - Deactivate the menu if the window is withdrawn
Deactivate the menu if the window is withdrawn
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-02-27 12:35 UTC by Rob Bradford
Modified: 2012-02-29 13:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] menu: Deactivate the menu if the GdkWindow is withdrawn (1.79 KB, patch)
2012-02-27 12:41 UTC, Rob Bradford
accepted-commit_now Details | Review

Description Rob Bradford 2012-02-27 12:35:36 UTC
If the window is hidden by the display server then deactivate the menu. So that it will be in the equivalent to as if the user had deactivated the window by e.g. clicking outside.

This is useful since under Wayland the popup menu grab is maintained by the compositor rather than the client. When the user clicks outside of the the menu the compositor breaks its grab.

Inside GDK we get notified of this however we need to signal through to GTK that this has happened - the currently proposed method is to hide the GdkWindow in the handler - triggering the WindowStateEvent with the WITHDRAWN bit set.

This patch to GTK+ reacts to this and deactivates the menu state - it comprises two parts - one part to prevent multiple firings for the "deactivate" signal and second to actually deactivate the window upon withdraw.
Comment 1 Rob Bradford 2012-02-27 12:41:27 UTC
Created attachment 208485 [details] [review]
[PATCH] menu: Deactivate the menu if the GdkWindow is withdrawn


If the display server or GDK hides the window - fire the "deactivate" signal
to ensure that the internal state is consistent.

This patch also ensures that the "deactivate" signal will not be fired for a
menu that is not active.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=670881
---
 gtk/gtkmenu.c      |    9 +++++++++
 gtk/gtkmenushell.c |    3 ++-
 2 files changed, 11 insertions(+), 1 deletions(-)
Comment 2 Emmanuele Bassi (:ebassi) 2012-02-27 17:27:22 UTC
Review of attachment 208485 [details] [review]:

looks okay to me; will need further review from another GTK developer, though.
Comment 3 Matthias Clasen 2012-02-28 19:01:47 UTC
Review of attachment 208485 [details] [review]:

Make sense to me too. We need to figure out the larger PopupWindow story, but for now these patches look fine.
Comment 4 Rob Bradford 2012-02-29 13:36:08 UTC
Thanks Matthias and Emmanuele:

commit 7cc3eb04ec5c77f01f25f21ef88723e00a96620e
Author: Rob Bradford <rob@linux.intel.com>
Date:   Mon Feb 27 12:35:25 2012 +0000

    menu: Deactivate the menu if the GdkWindow is withdrawn
    
    If the display server or GDK hides the window - fire the "deactivate" signal
    to ensure that the internal state is consistent.
    
    This patch also ensures that the "deactivate" signal will not be fired for a
    menu that is not active.
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=670881