changeset 59415:72adb36e240f

* xmenu.c (create_and_show_popup_menu): Pass zero as button to gtk_menu_popup if not for_click, so callbacks for the menu are called.
author Jan Djärv <jan.h.d@swipnet.se>
date Fri, 07 Jan 2005 20:50:46 +0000
parents c19f74a9fbaf
children d736a1979b98
files src/ChangeLog src/xmenu.c
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jan 07 20:26:30 2005 +0000
+++ b/src/ChangeLog	Fri Jan 07 20:50:46 2005 +0000
@@ -1,5 +1,8 @@
 2005-01-07  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
+	* xmenu.c (create_and_show_popup_menu): Pass zero as button to
+	gtk_menu_popup if not for_click, so callbacks for the menu are called.
+
 	* gtkutil.c (xg_gtk_scroll_destroy, xg_create_scroll_bar)
 	(xg_tool_bar_callback, xg_tool_bar_help_callback)
 	(update_frame_tool_bar): Cast to EMACS_INT to avoid compiler
--- a/src/xmenu.c	Fri Jan 07 20:26:30 2005 +0000
+++ b/src/xmenu.c	Fri Jan 07 20:50:46 2005 +0000
@@ -2454,10 +2454,6 @@
                            G_CALLBACK (menu_highlight_callback));
   xg_crazy_callback_abort = 0;
 
-  for (i = 0; i < 5; i++)
-    if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
-      break;
-
   if (! for_click)
     {
       /* Not invoked by a click.  pop up at x/y.  */
@@ -2470,8 +2466,16 @@
       popup_x_y.x = x;
       popup_x_y.y = y;
       popup_x_y.f = f;
+
+      i = 0;  /* gtk_menu_popup needs this to be 0 for a non-button popup.  */
     }
-
+  else
+    {
+      for (i = 0; i < 5; i++)
+        if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
+          break;
+    }
+  
   /* Display the menu.  */
   gtk_widget_show_all (menu);
   gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);