changeset 109291:35d06d80fc61

Fix hang for mouse press on menubar but not on an item (Bug#6499). * xmenu.c (x_activate_menubar): Send Press/Release for Gtk+ to avoid grab on just Press (Bug#6499).
author Jan D <jan.h.d@swipnet.se>
date Sat, 03 Jul 2010 11:38:44 +0200
parents 1b5ca039f5f2
children 69cc7cbe898b
files src/ChangeLog src/xmenu.c
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jul 02 12:35:08 2010 -0400
+++ b/src/ChangeLog	Sat Jul 03 11:38:44 2010 +0200
@@ -1,3 +1,8 @@
+2010-07-03  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* xmenu.c (x_activate_menubar): Send Press/Release for Gtk+ to avoid
+	grab on just Press (Bug#6499).
+
 2010-07-02  Chong Yidong  <cyd@stupidchicken.com>
 
 	* frame.c (Qtooltip): New var.
--- a/src/xmenu.c	Fri Jul 02 12:35:08 2010 -0400
+++ b/src/xmenu.c	Sat Jul 03 11:38:44 2010 +0200
@@ -684,6 +684,14 @@
   set_frame_menubar (f, 0, 1);
   BLOCK_INPUT;
 #ifdef USE_GTK
+  /* If we click outside any menu item, the menu bar still grabs.
+     So we send Press and the Release.  If outside, grab is released.
+     If on a menu item, it is popped up normally.
+     PutBack is like a stack, so we put back in reverse order.  */
+  f->output_data.x->saved_menu_event->type = ButtonRelease;
+  XPutBackEvent (f->output_data.x->display_info->display,
+                 f->output_data.x->saved_menu_event);
+  f->output_data.x->saved_menu_event->type = ButtonPress;
   XPutBackEvent (f->output_data.x->display_info->display,
                  f->output_data.x->saved_menu_event);
   popup_activated_flag = 1;