comparison src/xmenu.c @ 59156:03a6e350cf4d

(popup_get_selection): Remove parameter down_on_keypress. (create_and_show_popup_menu, create_and_show_dialog): Remove parameter down_on_keypress to popup_get_selection.
author Jan Djärv <jan.h.d@swipnet.se>
date Mon, 27 Dec 2004 20:56:56 +0000
parents 6690f246cffe
children 72adb36e240f 223c12363c0c 95879cc1ed20
comparison
equal deleted inserted replaced
59155:6690f246cffe 59156:03a6e350cf4d
114 extern void set_frame_menubar P_ ((FRAME_PTR, int, int)); 114 extern void set_frame_menubar P_ ((FRAME_PTR, int, int));
115 extern XtAppContext Xt_app_con; 115 extern XtAppContext Xt_app_con;
116 116
117 static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); 117 static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **));
118 static void popup_get_selection P_ ((XEvent *, struct x_display_info *, 118 static void popup_get_selection P_ ((XEvent *, struct x_display_info *,
119 LWLIB_ID, int, int)); 119 LWLIB_ID, int));
120 120
121 /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ 121 /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */
122 122
123 #define HAVE_BOXES 1 123 #define HAVE_BOXES 1
124 #endif /* USE_X_TOOLKIT */ 124 #endif /* USE_X_TOOLKIT */
1184 1184
1185 /* Loop in Xt until the menu pulldown or dialog popup has been 1185 /* Loop in Xt until the menu pulldown or dialog popup has been
1186 popped down (deactivated). This is used for x-popup-menu 1186 popped down (deactivated). This is used for x-popup-menu
1187 and x-popup-dialog; it is not used for the menu bar. 1187 and x-popup-dialog; it is not used for the menu bar.
1188 1188
1189 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed.
1190
1191 NOTE: All calls to popup_get_selection should be protected 1189 NOTE: All calls to popup_get_selection should be protected
1192 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ 1190 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */
1193 1191
1194 static void 1192 static void
1195 popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) 1193 popup_get_selection (initial_event, dpyinfo, id, do_timers)
1196 XEvent *initial_event; 1194 XEvent *initial_event;
1197 struct x_display_info *dpyinfo; 1195 struct x_display_info *dpyinfo;
1198 LWLIB_ID id; 1196 LWLIB_ID id;
1199 int do_timers; 1197 int do_timers;
1200 int down_on_keypress;
1201 { 1198 {
1202 XEvent event; 1199 XEvent event;
1203 1200
1204 while (popup_activated_flag) 1201 while (popup_activated_flag)
1205 { 1202 {
1232 event.xbutton.state = 0; 1229 event.xbutton.state = 0;
1233 #endif 1230 #endif
1234 } 1231 }
1235 /* Pop down on C-g and Escape. */ 1232 /* Pop down on C-g and Escape. */
1236 else if (event.type == KeyPress 1233 else if (event.type == KeyPress
1237 && down_on_keypress
1238 && dpyinfo->display == event.xbutton.display) 1234 && dpyinfo->display == event.xbutton.display)
1239 { 1235 {
1240 KeySym keysym = XLookupKeysym (&event.xkey, 0); 1236 KeySym keysym = XLookupKeysym (&event.xkey, 0);
1241 1237
1242 if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0) 1238 if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0)
2597 record_unwind_protect (pop_down_menu, 2593 record_unwind_protect (pop_down_menu,
2598 Fcons (make_number (menu_id >> (fact)), 2594 Fcons (make_number (menu_id >> (fact)),
2599 make_number (menu_id & ~(-1 << (fact))))); 2595 make_number (menu_id & ~(-1 << (fact)))));
2600 2596
2601 /* Process events that apply to the menu. */ 2597 /* Process events that apply to the menu. */
2602 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1, 0); 2598 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1);
2603 2599
2604 unbind_to (specpdl_count, Qnil); 2600 unbind_to (specpdl_count, Qnil);
2605 } 2601 }
2606 } 2602 }
2607 2603
2975 record_unwind_protect (pop_down_menu, 2971 record_unwind_protect (pop_down_menu,
2976 Fcons (make_number (dialog_id >> (fact)), 2972 Fcons (make_number (dialog_id >> (fact)),
2977 make_number (dialog_id & ~(-1 << (fact))))); 2973 make_number (dialog_id & ~(-1 << (fact)))));
2978 2974
2979 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), 2975 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f),
2980 dialog_id, 1, 1); 2976 dialog_id, 1);
2981 2977
2982 unbind_to (count, Qnil); 2978 unbind_to (count, Qnil);
2983 } 2979 }
2984 } 2980 }
2985 2981