aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2004-01-12 01:46:49 +0000
committerJan Djärv2004-01-12 01:46:49 +0000
commit66070bd113a6a6f7397fb0af264495c5daaea43c (patch)
tree98f2c529399de75a98afbffd8bc0d685e59316e0 /src
parent244c93fe5767497dd45bb3d3ad22a9c72ccc2d5b (diff)
downloademacs-66070bd113a6a6f7397fb0af264495c5daaea43c.tar.gz
emacs-66070bd113a6a6f7397fb0af264495c5daaea43c.zip
* xmenu.c (popup_get_selection): Check new parameter down_on_keypress
if a key press should pop down. Only pop down if a key is pressed outside the menu/dialog. (create_and_show_popup_menu): Pass 0 for down_on_keypress to popup_get_selection. (create_and_show_dialog): Pass 1 for down_on_keypress to popup_get_selection.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/xmenu.c22
2 files changed, 25 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8b6160fb5eb..9c21defd658 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12004-01-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * xmenu.c (popup_get_selection): Check new parameter down_on_keypress
4 if a key press should pop down. Only pop down if a key is pressed
5 outside the menu/dialog.
6 (create_and_show_popup_menu): Pass 0 for down_on_keypress to
7 popup_get_selection.
8 (create_and_show_dialog): Pass 1 for down_on_keypress to
9 popup_get_selection.
10
12004-01-11 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 112004-01-11 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 12
3 * alloc.c (allocate_vectorlike): Surround calls to mallopt with 13 * alloc.c (allocate_vectorlike): Surround calls to mallopt with
diff --git a/src/xmenu.c b/src/xmenu.c
index 439f5002dde..473e29de88d 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1121,17 +1121,19 @@ on the left of the dialog box and all following items on the right.
1121 and x-popup-dialog; it is not used for the menu bar. 1121 and x-popup-dialog; it is not used for the menu bar.
1122 1122
1123 If DO_TIMERS is nonzero, run timers. 1123 If DO_TIMERS is nonzero, run timers.
1124 If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed.
1124 1125
1125 NOTE: All calls to popup_get_selection should be protected 1126 NOTE: All calls to popup_get_selection should be protected
1126 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ 1127 with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */
1127 1128
1128#ifdef USE_X_TOOLKIT 1129#ifdef USE_X_TOOLKIT
1129static void 1130static void
1130popup_get_selection (initial_event, dpyinfo, id, do_timers) 1131popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress)
1131 XEvent *initial_event; 1132 XEvent *initial_event;
1132 struct x_display_info *dpyinfo; 1133 struct x_display_info *dpyinfo;
1133 LWLIB_ID id; 1134 LWLIB_ID id;
1134 int do_timers; 1135 int do_timers;
1136 int down_on_keypress;
1135{ 1137{
1136 XEvent event; 1138 XEvent event;
1137 1139
@@ -1167,15 +1169,20 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers)
1167 event.xbutton.state = 0; 1169 event.xbutton.state = 0;
1168#endif 1170#endif
1169 } 1171 }
1170 /* If the user presses a key, deactivate the menu. 1172 /* If the user presses a key that doesn't go to the menu,
1173 deactivate the menu.
1171 The user is likely to do that if we get wedged. 1174 The user is likely to do that if we get wedged.
1172 This is mostly for Lucid, Motif pops down the menu on ESC. */ 1175 All toolkits now pop down menus on ESC.
1176 For dialogs however, the focus may not be on the dialog, so
1177 in that case, we pop down. */
1173 else if (event.type == KeyPress 1178 else if (event.type == KeyPress
1179 && down_on_keypress
1174 && dpyinfo->display == event.xbutton.display) 1180 && dpyinfo->display == event.xbutton.display)
1175 { 1181 {
1176 KeySym keysym = XLookupKeysym (&event.xkey, 0); 1182 KeySym keysym = XLookupKeysym (&event.xkey, 0);
1177 if (!IsModifierKey (keysym)) 1183 if (!IsModifierKey (keysym)
1178 popup_activated_flag = 0; 1184 && x_any_window_to_frame (dpyinfo, event.xany.window) != NULL)
1185 popup_activated_flag = 0;
1179 } 1186 }
1180 1187
1181 x_dispatch_event (&event, event.xany.display); 1188 x_dispatch_event (&event, event.xany.display);
@@ -2448,7 +2455,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click)
2448 popup_activated_flag = 1; 2455 popup_activated_flag = 1;
2449 2456
2450 /* Process events that apply to the menu. */ 2457 /* Process events that apply to the menu. */
2451 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0); 2458 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0);
2452 2459
2453 /* fp turned off the following statement and wrote a comment 2460 /* fp turned off the following statement and wrote a comment
2454 that it is unnecessary--that the menu has already disappeared. 2461 that it is unnecessary--that the menu has already disappeared.
@@ -2842,7 +2849,8 @@ create_and_show_dialog (f, first_wv)
2842 Fcons (make_number (dialog_id >> (fact)), 2849 Fcons (make_number (dialog_id >> (fact)),
2843 make_number (dialog_id & ~(-1 << (fact))))); 2850 make_number (dialog_id & ~(-1 << (fact)))));
2844 2851
2845 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1); 2852 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f),
2853 dialog_id, 1, 1);
2846 2854
2847 unbind_to (count, Qnil); 2855 unbind_to (count, Qnil);
2848 } 2856 }