GNOME Bugzilla – Bug 670881
Deactivate the menu if the window is withdrawn
Last modified: 2012-02-29 13:36:08 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.
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(-)
Review of attachment 208485 [details] [review]: looks okay to me; will need further review from another GTK developer, though.
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.
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