Mercurial > emacs
comparison src/xmenu.c @ 57965:9b14127a651a
* eval.c (Feval): Remove check for INPUT_BLOCKED_P.
* xmenu.c (popup_get_selection, create_and_show_popup_menu)
(create_and_show_dialog): Revert change from 2004-10-31.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sat, 06 Nov 2004 07:47:27 +0000 |
parents | fad95a27e1d8 |
children | ab22e6ae6fac 9ea0f6980511 cb7f41387eb3 |
comparison
equal
deleted
inserted
replaced
57964:05c49cd7076a | 57965:9b14127a651a |
---|---|
113 extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); | 113 extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); |
114 extern XtAppContext Xt_app_con; | 114 extern XtAppContext Xt_app_con; |
115 | 115 |
116 static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); | 116 static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); |
117 static void popup_get_selection P_ ((XEvent *, struct x_display_info *, | 117 static void popup_get_selection P_ ((XEvent *, struct x_display_info *, |
118 LWLIB_ID, int)); | 118 LWLIB_ID, int, int)); |
119 | 119 |
120 /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ | 120 /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ |
121 | 121 |
122 #define HAVE_BOXES 1 | 122 #define HAVE_BOXES 1 |
123 #endif /* USE_X_TOOLKIT */ | 123 #endif /* USE_X_TOOLKIT */ |
154 static void keymap_panes P_ ((Lisp_Object *, int, int)); | 154 static void keymap_panes P_ ((Lisp_Object *, int, int)); |
155 static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 155 static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
156 int, int)); | 156 int, int)); |
157 static void list_of_panes P_ ((Lisp_Object)); | 157 static void list_of_panes P_ ((Lisp_Object)); |
158 static void list_of_items P_ ((Lisp_Object)); | 158 static void list_of_items P_ ((Lisp_Object)); |
159 | |
160 extern EMACS_TIME timer_check P_ ((int)); | |
159 | 161 |
160 | 162 |
161 /* This holds a Lisp vector that holds the results of decoding | 163 /* This holds a Lisp vector that holds the results of decoding |
162 the keymaps or alist-of-alists that specify a menu. | 164 the keymaps or alist-of-alists that specify a menu. |
163 | 165 |
1120 popped down (deactivated). This is used for x-popup-menu | 1122 popped down (deactivated). This is used for x-popup-menu |
1121 and x-popup-dialog; it is not used for the menu bar. | 1123 and x-popup-dialog; it is not used for the menu bar. |
1122 | 1124 |
1123 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed. | 1125 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed. |
1124 | 1126 |
1125 This function used to have a DO_TIMERS argument which was | |
1126 1 in the dialog case, and caused it to run Lisp-level timers. | |
1127 That was unsafe so we removed it, but does anyone remember | |
1128 why menus and dialogs were treated differently? | |
1129 | |
1130 NOTE: All calls to popup_get_selection should be protected | 1127 NOTE: All calls to popup_get_selection should be protected |
1131 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ | 1128 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ |
1132 | 1129 |
1133 #ifdef USE_X_TOOLKIT | 1130 #ifdef USE_X_TOOLKIT |
1134 static void | 1131 static void |
1135 popup_get_selection (initial_event, dpyinfo, id, down_on_keypress) | 1132 popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) |
1136 XEvent *initial_event; | 1133 XEvent *initial_event; |
1137 struct x_display_info *dpyinfo; | 1134 struct x_display_info *dpyinfo; |
1138 LWLIB_ID id; | 1135 LWLIB_ID id; |
1136 int do_timers; | |
1139 int down_on_keypress; | 1137 int down_on_keypress; |
1140 { | 1138 { |
1141 XEvent event; | 1139 XEvent event; |
1142 | 1140 |
1143 while (popup_activated_flag) | 1141 while (popup_activated_flag) |
1144 { | 1142 { |
1145 if (initial_event) | 1143 /* If we have no events to run, consider timers. */ |
1144 if (do_timers && !XtAppPending (Xt_app_con)) | |
1145 timer_check (1); | |
1146 | |
1147 if (initial_event) | |
1146 { | 1148 { |
1147 event = *initial_event; | 1149 event = *initial_event; |
1148 initial_event = 0; | 1150 initial_event = 0; |
1149 } | 1151 } |
1150 else | 1152 else |
2486 /* Display the menu. */ | 2488 /* Display the menu. */ |
2487 lw_popup_menu (menu, (XEvent *) &dummy); | 2489 lw_popup_menu (menu, (XEvent *) &dummy); |
2488 popup_activated_flag = 1; | 2490 popup_activated_flag = 1; |
2489 | 2491 |
2490 /* Process events that apply to the menu. */ | 2492 /* Process events that apply to the menu. */ |
2491 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0); | 2493 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0); |
2492 | 2494 |
2493 /* fp turned off the following statement and wrote a comment | 2495 /* fp turned off the following statement and wrote a comment |
2494 that it is unnecessary--that the menu has already disappeared. | 2496 that it is unnecessary--that the menu has already disappeared. |
2495 Nowadays the menu disappears ok, all right, but | 2497 Nowadays the menu disappears ok, all right, but |
2496 we need to delete the widgets or multiple ones will pile up. */ | 2498 we need to delete the widgets or multiple ones will pile up. */ |
2880 /* xdialog_show_unwind is responsible for popping the dialog box down. */ | 2882 /* xdialog_show_unwind is responsible for popping the dialog box down. */ |
2881 record_unwind_protect (xdialog_show_unwind, | 2883 record_unwind_protect (xdialog_show_unwind, |
2882 Fcons (make_number (dialog_id >> (fact)), | 2884 Fcons (make_number (dialog_id >> (fact)), |
2883 make_number (dialog_id & ~(-1 << (fact))))); | 2885 make_number (dialog_id & ~(-1 << (fact))))); |
2884 | 2886 |
2885 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1); | 2887 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), |
2888 dialog_id, 1, 1); | |
2886 | 2889 |
2887 unbind_to (count, Qnil); | 2890 unbind_to (count, Qnil); |
2888 } | 2891 } |
2889 } | 2892 } |
2890 | 2893 |