+ /* Handle expose events for editor frames right away. */
+ if (event.type == Expose)
+ process_expose_from_menu (event);
+ /* Make sure we don't consider buttons grabbed after menu goes. */
+ else if (event.type == ButtonRelease
+ && dpyinfo->display == event.xbutton.display)
+ dpyinfo->grabbed &= ~(1 << event.xbutton.button);
+ /* If the user presses a key, deactivate the menu.
+ The user is likely to do that if we get wedged. */
+ else if (event.type == KeyPress
+ && dpyinfo->display == event.xbutton.display)
+ {
+ popup_activated_flag = 0;
+ break;
+ }
+
+ /* Queue all events not for this popup,
+ except for Expose, which we've already handled.
+ Note that the X window is associated with the frame if this
+ is a menu bar popup, but not if it's a dialog box. So we use
+ x_non_menubar_window_to_frame, not x_any_window_to_frame. */
+ if (event.type != Expose
+ && (event.xany.display != dpyinfo->display
+ || x_non_menubar_window_to_frame (dpyinfo, event.xany.window)))
+ {
+ queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue));
+
+ if (queue_tmp != NULL)
+ {
+ queue_tmp->event = event;
+ queue_tmp->next = queue;
+ queue = queue_tmp;
+ }
+ }
+ else
+ XtDispatchEvent (&event);
+
+ if (!popup_activated ())