diff src/xmenu.c @ 8175:c3bc5fca374f

(xmenu_show) {USE_X_TOOLKIT}: ButtonPress no longer pops down; instead it forces the next ButtonRelease to exit. Don't dispatch on ButtonPress events.
author Richard M. Stallman <rms@gnu.org>
date Thu, 07 Jul 1994 19:24:56 +0000
parents 6fa3cd9b176d
children 53a82f01e723
line wrap: on
line diff
--- a/src/xmenu.c	Thu Jul 07 18:39:02 1994 +0000
+++ b/src/xmenu.c	Thu Jul 07 19:24:56 1994 +0000
@@ -1416,6 +1416,7 @@
   Position root_x, root_y;
 
   int first_pane;
+  int next_release_must_exit = 0;
 
   *error = NULL;
 
@@ -1655,16 +1656,27 @@
 		Vmouse_depressed = Qnil;
 	    }
 	  if (! (menu_item_selection == 0
+		 && !next_release_must_exit
 		 && (((XButtonEvent *) (&event))->time - last_event_timestamp
 		     < XINT (Vdouble_click_time))))
 	    break;
+	  /* Don't call XtDispatchEvent again for the same event!  */
+	  continue;
 	}
       else if (event.type == ButtonPress)
 	{
+	  next_release_must_exit = 1;
+#if 0
+	  XtDispatchEvent (&event);
 	  /* Any mouse button activity that doesn't select in the menu
 	     should unpost the menu.  */
 	  if (menu_item_selection == 0)
 	    break;
+#endif
+	  /* Don't call XtDispatchEvent for the down event.
+	     Doing so seems to give strange results
+	     when you click on the menu bar while a menu is posted.  */
+	  continue;
 	}
       else if (event.type == KeyPress)
 	{