diff options
| author | Richard M. Stallman | 1996-12-26 21:00:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-12-26 21:00:03 +0000 |
| commit | 8eb4d8ef14377fe13f204e0e04d91b8cda7c1ee7 (patch) | |
| tree | a1136ebf8a280f1221792276986b5006cb70173d /src | |
| parent | 2e13f8e971fe827a2b3e6e3a199b4537f77cecd6 (diff) | |
| download | emacs-8eb4d8ef14377fe13f204e0e04d91b8cda7c1ee7.tar.gz emacs-8eb4d8ef14377fe13f204e0e04d91b8cda7c1ee7.zip | |
(read_char_x_menu_prompt): Unread and record all the input events from here.
(record_menu_key): New subroutine.
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 57 |
1 files changed, 52 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 886857702e0..37bbb0c2245 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -474,6 +474,8 @@ EMACS_TIME timer_check (); | |||
| 474 | 474 | ||
| 475 | extern char *x_get_keysym_name (); | 475 | extern char *x_get_keysym_name (); |
| 476 | 476 | ||
| 477 | static void record_menu_key (); | ||
| 478 | |||
| 477 | Lisp_Object Qpolling_period; | 479 | Lisp_Object Qpolling_period; |
| 478 | 480 | ||
| 479 | /* List of absolute timers. Appears in order of next scheduled event. */ | 481 | /* List of absolute timers. Appears in order of next scheduled event. */ |
| @@ -1902,7 +1904,14 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1902 | /* Don't bring up a menu if we already have another event. */ | 1904 | /* Don't bring up a menu if we already have another event. */ |
| 1903 | && NILP (Vunread_command_events) | 1905 | && NILP (Vunread_command_events) |
| 1904 | && unread_command_char < 0) | 1906 | && unread_command_char < 0) |
| 1905 | c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); | 1907 | { |
| 1908 | c = read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu); | ||
| 1909 | |||
| 1910 | /* Now that we have read an event, Emacs is not idle. */ | ||
| 1911 | timer_stop_idle (); | ||
| 1912 | |||
| 1913 | return c; | ||
| 1914 | } | ||
| 1906 | 1915 | ||
| 1907 | /* Maybe autosave and/or garbage collect due to idleness. */ | 1916 | /* Maybe autosave and/or garbage collect due to idleness. */ |
| 1908 | 1917 | ||
| @@ -2214,6 +2223,39 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2214 | return c; | 2223 | return c; |
| 2215 | } | 2224 | } |
| 2216 | 2225 | ||
| 2226 | /* Record a key that came from a mouse menu. | ||
| 2227 | Record it for echoing, for this-command-keys, and so on. */ | ||
| 2228 | |||
| 2229 | static void | ||
| 2230 | record_menu_key (c) | ||
| 2231 | Lisp_Object c; | ||
| 2232 | { | ||
| 2233 | /* Wipe the echo area. */ | ||
| 2234 | echo_area_glyphs = 0; | ||
| 2235 | |||
| 2236 | record_char (c); | ||
| 2237 | |||
| 2238 | before_command_key_count = this_command_key_count; | ||
| 2239 | before_command_echo_length = echo_length (); | ||
| 2240 | |||
| 2241 | /* Don't echo mouse motion events. */ | ||
| 2242 | if (echo_keystrokes) | ||
| 2243 | { | ||
| 2244 | echo_char (c); | ||
| 2245 | |||
| 2246 | /* Once we reread a character, echoing can happen | ||
| 2247 | the next time we pause to read a new one. */ | ||
| 2248 | ok_to_echo_at_next_pause = 0; | ||
| 2249 | } | ||
| 2250 | |||
| 2251 | /* Record this character as part of the current key. */ | ||
| 2252 | add_command_key (c); | ||
| 2253 | |||
| 2254 | /* Re-reading in the middle of a command */ | ||
| 2255 | last_input_char = c; | ||
| 2256 | num_input_chars++; | ||
| 2257 | } | ||
| 2258 | |||
| 2217 | /* Return 1 if should recognize C as "the help character". */ | 2259 | /* Return 1 if should recognize C as "the help character". */ |
| 2218 | 2260 | ||
| 2219 | int | 2261 | int |
| @@ -5374,6 +5416,8 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu) | |||
| 5374 | { | 5416 | { |
| 5375 | Lisp_Object tem; | 5417 | Lisp_Object tem; |
| 5376 | 5418 | ||
| 5419 | record_menu_key (XCONS (value)->car); | ||
| 5420 | |||
| 5377 | /* If we got multiple events, unread all but | 5421 | /* If we got multiple events, unread all but |
| 5378 | the first. | 5422 | the first. |
| 5379 | There is no way to prevent those unread events | 5423 | There is no way to prevent those unread events |
| @@ -5384,10 +5428,13 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu) | |||
| 5384 | they won't confuse things. */ | 5428 | they won't confuse things. */ |
| 5385 | for (tem = XCONS (value)->cdr; !NILP (tem); | 5429 | for (tem = XCONS (value)->cdr; !NILP (tem); |
| 5386 | tem = XCONS (tem)->cdr) | 5430 | tem = XCONS (tem)->cdr) |
| 5387 | if (SYMBOLP (XCONS (tem)->car) | 5431 | { |
| 5388 | || INTEGERP (XCONS (tem)->car)) | 5432 | record_menu_key (XCONS (tem)->car); |
| 5389 | XCONS (tem)->car | 5433 | if (SYMBOLP (XCONS (tem)->car) |
| 5390 | = Fcons (XCONS (tem)->car, Qnil); | 5434 | || INTEGERP (XCONS (tem)->car)) |
| 5435 | XCONS (tem)->car | ||
| 5436 | = Fcons (XCONS (tem)->car, Qnil); | ||
| 5437 | } | ||
| 5391 | 5438 | ||
| 5392 | /* If we got more than one event, put all but the first | 5439 | /* If we got more than one event, put all but the first |
| 5393 | onto this list to be read later. | 5440 | onto this list to be read later. |