Mercurial > emacs
comparison src/xmenu.c @ 11954:4117d74ba254
(popup_get_selection): Force deactivation if key pressed.
New arg `id'.
(xdialog_show, xmenu_show): Pass new arg to popup_get_selection.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 26 May 1995 22:47:07 +0000 |
parents | da016ba65a6c |
children | f5d820ad7a13 |
comparison
equal
deleted
inserted
replaced
11953:d349456b4b1c | 11954:4117d74ba254 |
---|---|
1040 #ifdef USE_X_TOOLKIT | 1040 #ifdef USE_X_TOOLKIT |
1041 | 1041 |
1042 /* Loop in Xt until the menu pulldown or dialog popup has been | 1042 /* Loop in Xt until the menu pulldown or dialog popup has been |
1043 popped down (deactivated). | 1043 popped down (deactivated). |
1044 | 1044 |
1045 NOTE: All calls to popup_get_selection() should be protected | 1045 NOTE: All calls to popup_get_selection should be protected |
1046 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ | 1046 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ |
1047 | 1047 |
1048 void | 1048 void |
1049 popup_get_selection (initial_event, dpyinfo) | 1049 popup_get_selection (initial_event, dpyinfo, id) |
1050 XEvent *initial_event; | 1050 XEvent *initial_event; |
1051 struct x_display_info *dpyinfo; | 1051 struct x_display_info *dpyinfo; |
1052 LWLIB_ID id; | |
1052 { | 1053 { |
1053 XEvent event; | 1054 XEvent event; |
1054 | 1055 |
1055 /* Define a queue to save up for later unreading | 1056 /* Define a queue to save up for later unreading |
1056 all X events that don't pertain to the menu. */ | 1057 all X events that don't pertain to the menu. */ |
1075 process_expose_from_menu (event); | 1076 process_expose_from_menu (event); |
1076 /* Make sure we don't consider buttons grabbed after menu goes. */ | 1077 /* Make sure we don't consider buttons grabbed after menu goes. */ |
1077 else if (event.type == ButtonRelease | 1078 else if (event.type == ButtonRelease |
1078 && dpyinfo->display == event.xbutton.display) | 1079 && dpyinfo->display == event.xbutton.display) |
1079 dpyinfo->grabbed &= ~(1 << event.xbutton.button); | 1080 dpyinfo->grabbed &= ~(1 << event.xbutton.button); |
1081 /* If the user presses a key, deactivate the menu. | |
1082 The user is likely to do that if we get wedged. */ | |
1083 else if (event.type == KeyPress | |
1084 && dpyinfo->display == event.xbutton.display) | |
1085 { | |
1086 lw_destroy_all_widgets (id); | |
1087 popup_activated_flag = 0; | |
1088 break; | |
1089 } | |
1080 | 1090 |
1081 /* Queue all events not for this popup, | 1091 /* Queue all events not for this popup, |
1082 except for Expose, which we've already handled. | 1092 except for Expose, which we've already handled. |
1083 Note that the X window is associated with the frame if this | 1093 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 | 1094 is a menu bar popup, but not if it's a dialog box. So we use |
1845 /* Display the menu. */ | 1855 /* Display the menu. */ |
1846 lw_popup_menu (menu); | 1856 lw_popup_menu (menu); |
1847 popup_activated_flag = 1; | 1857 popup_activated_flag = 1; |
1848 | 1858 |
1849 /* Process events that apply to the menu. */ | 1859 /* Process events that apply to the menu. */ |
1850 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f)); | 1860 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id); |
1851 | 1861 |
1852 #if 0 | 1862 #if 0 |
1853 /* fp turned off the following statement and wrote a comment | 1863 /* fp turned off the following statement and wrote a comment |
1854 that it is unnecessary--that the menu has already disappeared. | 1864 that it is unnecessary--that the menu has already disappeared. |
1855 I observer that is not so. -- rms. */ | 1865 I observer that is not so. -- rms. */ |
2063 /* Display the menu. */ | 2073 /* Display the menu. */ |
2064 lw_pop_up_all_widgets (dialog_id); | 2074 lw_pop_up_all_widgets (dialog_id); |
2065 popup_activated_flag = 1; | 2075 popup_activated_flag = 1; |
2066 | 2076 |
2067 /* Process events that apply to the menu. */ | 2077 /* Process events that apply to the menu. */ |
2068 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f)); | 2078 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id); |
2069 | 2079 |
2070 /* Find the selected item, and its pane, to return | 2080 /* Find the selected item, and its pane, to return |
2071 the proper value. */ | 2081 the proper value. */ |
2072 if (menu_item_selection != 0) | 2082 if (menu_item_selection != 0) |
2073 { | 2083 { |