diff options
| author | Karl Heuer | 1995-05-26 22:47:07 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-05-26 22:47:07 +0000 |
| commit | 2e2b8e220e0e688875c6f3892884bf607adc2761 (patch) | |
| tree | 6ddc0b64286038afc63325324dc9743aa8156590 /src | |
| parent | 7c21100ae357160662f38efe745aba1934ad1e4c (diff) | |
| download | emacs-2e2b8e220e0e688875c6f3892884bf607adc2761.tar.gz emacs-2e2b8e220e0e688875c6f3892884bf607adc2761.zip | |
(popup_get_selection): Force deactivation if key pressed.
New arg `id'.
(xdialog_show, xmenu_show): Pass new arg to popup_get_selection.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xmenu.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index c403438e99c..b29dd64b0a7 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1042,13 +1042,14 @@ on the left of the dialog box and all following items on the right.\n\ | |||
| 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 | ||
| @@ -1077,6 +1078,15 @@ popup_get_selection (initial_event, dpyinfo) | |||
| 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. |
| @@ -1847,7 +1857,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 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 |
| @@ -2065,7 +2075,7 @@ xdialog_show (f, keymaps, title, error) | |||
| 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. */ |