comparison src/xmenu.c @ 11614:fdd0d5bdd8c6

(popup_get_selection): Use x_non_menubar_window_to_frame. Either queue or dispatch the event, but not both. (dialog_selection_callback): Clear popup_activated_flag. (Fx_popup_menu): If POSITION is just (menu-bar), use the current mouse position. (menubar_selection_callback): Use (menu-bar) instead of 'menu-bar.
author Karl Heuer <kwzh@gnu.org>
date Sat, 29 Apr 1995 04:21:23 +0000
parents 29d1cbdd2ca4
children a9f93ce6e1b4
comparison
equal deleted inserted replaced
11613:c4ef6460a9c9 11614:fdd0d5bdd8c6
761 if (! NILP (position)) 761 if (! NILP (position))
762 { 762 {
763 check_x (); 763 check_x ();
764 764
765 /* Decode the first argument: find the window and the coordinates. */ 765 /* Decode the first argument: find the window and the coordinates. */
766 if (EQ (position, Qt)) 766 if (EQ (position, Qt)
767 || (CONSP (position) && EQ (XCONS (position)->car, Qmenu_bar)))
767 { 768 {
768 /* Use the mouse's current position. */ 769 /* Use the mouse's current position. */
769 FRAME_PTR new_f = selected_frame; 770 FRAME_PTR new_f = selected_frame;
770 Lisp_Object bar_window; 771 Lisp_Object bar_window;
771 int part; 772 int part;
1076 else if (event.type == ButtonRelease 1077 else if (event.type == ButtonRelease
1077 && dpyinfo->display == event.xbutton.display) 1078 && dpyinfo->display == event.xbutton.display)
1078 dpyinfo->grabbed &= ~(1 << event.xbutton.button); 1079 dpyinfo->grabbed &= ~(1 << event.xbutton.button);
1079 1080
1080 /* Queue all events not for this popup, 1081 /* Queue all events not for this popup,
1081 except for Expose, which we've already handled. */ 1082 except for Expose, which we've already handled.
1083 Note that the X window is associated with the frame if this
1084 is a menu bar popup, but not if it's a dialog box. So we use
1085 x_non_menubar_window_to_frame, not x_any_window_to_frame. */
1082 if (event.type != Expose 1086 if (event.type != Expose
1083 && (event.xany.display != dpyinfo->display 1087 && (event.xany.display != dpyinfo->display
1084 || ! x_any_window_to_frame (dpyinfo, event.xany.window))) 1088 || x_non_menubar_window_to_frame (dpyinfo, event.xany.window)))
1085 { 1089 {
1086
1087 queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue)); 1090 queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue));
1088 1091
1089 if (queue_tmp != NULL) 1092 if (queue_tmp != NULL)
1090 { 1093 {
1091 queue_tmp->event = event; 1094 queue_tmp->event = event;
1092 queue_tmp->next = queue; 1095 queue_tmp->next = queue;
1093 queue = queue_tmp; 1096 queue = queue_tmp;
1094 } 1097 }
1095 } 1098 }
1096 1099 else
1097 XtDispatchEvent (&event); 1100 XtDispatchEvent (&event);
1098 1101
1099 if (!popup_activated ()) 1102 if (!popup_activated ())
1100 break; 1103 break;
1101 XtAppNextEvent (Xt_app_con, &event); 1104 XtAppNextEvent (Xt_app_con, &event);
1102 } 1105 }
1189 struct input_event buf; 1192 struct input_event buf;
1190 Lisp_Object frame; 1193 Lisp_Object frame;
1191 1194
1192 XSETFRAME (frame, f); 1195 XSETFRAME (frame, f);
1193 buf.kind = menu_bar_event; 1196 buf.kind = menu_bar_event;
1194 buf.frame_or_window = Fcons (frame, Qmenu_bar); 1197 buf.frame_or_window = Fcons (frame, Fcons (Qmenu_bar, Qnil));
1195 kbd_buffer_store_event (&buf); 1198 kbd_buffer_store_event (&buf);
1196 1199
1197 for (j = 0; j < submenu_depth; j++) 1200 for (j = 0; j < submenu_depth; j++)
1198 if (!NILP (subprefix_stack[j])) 1201 if (!NILP (subprefix_stack[j]))
1199 { 1202 {
1900 if ((int) (EMACS_INT) client_data != -1) 1903 if ((int) (EMACS_INT) client_data != -1)
1901 menu_item_selection = (Lisp_Object *) client_data; 1904 menu_item_selection = (Lisp_Object *) client_data;
1902 BLOCK_INPUT; 1905 BLOCK_INPUT;
1903 lw_destroy_all_widgets (id); 1906 lw_destroy_all_widgets (id);
1904 UNBLOCK_INPUT; 1907 UNBLOCK_INPUT;
1908 popup_activated_flag = 0;
1905 } 1909 }
1906 1910
1907 static char * button_names [] = { 1911 static char * button_names [] = {
1908 "button1", "button2", "button3", "button4", "button5", 1912 "button1", "button2", "button3", "button4", "button5",
1909 "button6", "button7", "button8", "button9", "button10" }; 1913 "button6", "button7", "button8", "button9", "button10" };