comparison src/xmenu.c @ 15628:f74c79dcaf8d

(popup_get_selection): For a ButtonRelease on the proper display, don't queue it, and always deactivate the menu.
author Karl Heuer <kwzh@gnu.org>
date Sun, 07 Jul 1996 22:46:15 +0000
parents 55a2ea0e640c
children 85d87cd0f655
comparison
equal deleted inserted replaced
15627:c5c4d478c78d 15628:f74c79dcaf8d
1094 while (1) 1094 while (1)
1095 { 1095 {
1096 /* Handle expose events for editor frames right away. */ 1096 /* Handle expose events for editor frames right away. */
1097 if (event.type == Expose) 1097 if (event.type == Expose)
1098 process_expose_from_menu (event); 1098 process_expose_from_menu (event);
1099 /* Make sure we don't consider buttons grabbed after menu goes. */ 1099 /* Make sure we don't consider buttons grabbed after menu goes.
1100 And make sure to deactivate for any ButtonRelease,
1101 even if XtDispatchEvent doesn't do that. */
1100 else if (event.type == ButtonRelease 1102 else if (event.type == ButtonRelease
1101 && dpyinfo->display == event.xbutton.display) 1103 && dpyinfo->display == event.xbutton.display)
1102 dpyinfo->grabbed &= ~(1 << event.xbutton.button); 1104 {
1105 dpyinfo->grabbed &= ~(1 << event.xbutton.button);
1106 popup_activated_flag = 0;
1107 }
1103 /* If the user presses a key, deactivate the menu. 1108 /* If the user presses a key, deactivate the menu.
1104 The user is likely to do that if we get wedged. */ 1109 The user is likely to do that if we get wedged. */
1105 else if (event.type == KeyPress 1110 else if (event.type == KeyPress
1106 && dpyinfo->display == event.xbutton.display) 1111 && dpyinfo->display == event.xbutton.display)
1107 { 1112 {
1116 popup_activated_flag = 0; 1121 popup_activated_flag = 0;
1117 break; 1122 break;
1118 } 1123 }
1119 1124
1120 /* Queue all events not for this popup, 1125 /* Queue all events not for this popup,
1121 except for Expose, which we've already handled. 1126 except for Expose, which we've already handled, and ButtonRelease.
1122 Note that the X window is associated with the frame if this 1127 Note that the X window is associated with the frame if this
1123 is a menu bar popup, but not if it's a dialog box. So we use 1128 is a menu bar popup, but not if it's a dialog box. So we use
1124 x_non_menubar_window_to_frame, not x_any_window_to_frame. */ 1129 x_non_menubar_window_to_frame, not x_any_window_to_frame. */
1125 if (event.type != Expose 1130 if (event.type != Expose
1131 && !(event.type == ButtonRelease
1132 && dpyinfo->display == event.xbutton.display)
1126 && (event.xany.display != dpyinfo->display 1133 && (event.xany.display != dpyinfo->display
1127 || x_non_menubar_window_to_frame (dpyinfo, event.xany.window))) 1134 || x_non_menubar_window_to_frame (dpyinfo, event.xany.window)))
1128 { 1135 {
1129 queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue)); 1136 queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue));
1130 1137