diff options
| author | Jim Blandy | 1992-10-11 06:42:03 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-10-11 06:42:03 +0000 |
| commit | cd21b83986f5d0f68ba8228f0aeca901677be8be (patch) | |
| tree | e4609f5078b4c15814d1647abc805cccabaac36a /src | |
| parent | 2f0b07e06c9b2c9bc62f615e471e2dcb04406d38 (diff) | |
| download | emacs-cd21b83986f5d0f68ba8228f0aeca901677be8be.tar.gz emacs-cd21b83986f5d0f68ba8228f0aeca901677be8be.zip | |
* keyboard.c (Vlast_event_frame): Make this variable exist even
when MULTI_FRAME isn't #defined. People might find it
necessary for writing correct programs, even when the programs
don't explicitly use multiple frames.
(read_char, kbd_buffer_store_event, kbd_buffer_get_event): No need
to test MULTI_FRAME before setting Vlast_event_frame.
(syms_of_keyboard): DEFVAR Vlast_event_frame whether or not
MULTI_FRAME is defined.
* keyboard.c: Add switch-frame events.
(Qswitch_frame): New event header symbol.
(head_table): Include Qswitch_frame in the table of event heads.
(kbd_buffer_get_event): Detect when a frame switch has occurred,
and return a frame switch event before the enqueued event.
(make_lispy_switch_frame): New function.
(unread_switch_frame): New variable.
(read_key_sequence): Don't throw away the key sequence if the user
switches frames in the middle of the sequence. Instead, when we
receive a switch-frame event in the middle of a key sequence, save
it, and stuff it into unread_switch_frame when the sequence
is complete.
(read_char): If unread_switch_frame is set, return that value.
(command_loop_1): No need to check Vlast_event_frame and select
new frames here; that's taken care of by switch-frame events now.
(syms_of_keyboard): Initialize and staticpro unread_switch_frame.
* keyboard.c (follow_key, read_key_sequence): Call access_keymap
with T_OK true.
* keyboard.c (apply_modifiers): Copy the value of BASE's
Qevent_kind property to the new symbol.
* keyboard.c (syms_of_keyboard): Qevent_kind should be initialized
to intern ("event-kind"), not intern ("event-type").
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 176 |
1 files changed, 126 insertions, 50 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 9afcb951a1b..bd76b4cd966 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -151,6 +151,11 @@ Lisp_Object last_input_char; | |||
| 151 | /* If not Qnil, an object to be read as the next command input. */ | 151 | /* If not Qnil, an object to be read as the next command input. */ |
| 152 | Lisp_Object unread_command_char; | 152 | Lisp_Object unread_command_char; |
| 153 | 153 | ||
| 154 | /* If not Qnil, this is a switch-frame event which we decided to put | ||
| 155 | off until the end of a key sequence. This should be read as the | ||
| 156 | next command input, after any unread_command_char. */ | ||
| 157 | Lisp_Object unread_switch_frame; | ||
| 158 | |||
| 154 | /* Char to use as prefix when a meta character is typed in. | 159 | /* Char to use as prefix when a meta character is typed in. |
| 155 | This is bound on entry to minibuffer in case ESC is changed there. */ | 160 | This is bound on entry to minibuffer in case ESC is changed there. */ |
| 156 | 161 | ||
| @@ -187,15 +192,16 @@ Lisp_Object last_command; | |||
| 187 | instead of the actual command. */ | 192 | instead of the actual command. */ |
| 188 | Lisp_Object this_command; | 193 | Lisp_Object this_command; |
| 189 | 194 | ||
| 190 | #ifdef MULTI_FRAME | ||
| 191 | /* The frame in which the last input event occurred, or Qmacro if the | 195 | /* The frame in which the last input event occurred, or Qmacro if the |
| 192 | last event came from a macro. | 196 | last event came from a macro. |
| 193 | command_loop_1 will select this frame before running the | 197 | command_loop_1 will select this frame before running the |
| 194 | command bound to an event sequence, and read_key_sequence will | 198 | command bound to an event sequence, and read_key_sequence will |
| 195 | toss the existing prefix if the user starts typing at a | 199 | toss the existing prefix if the user starts typing at a |
| 196 | new frame. */ | 200 | new frame. |
| 201 | |||
| 202 | On a non-multi-frame Emacs, this will be either Qmacro or | ||
| 203 | selected_frame. */ | ||
| 197 | Lisp_Object Vlast_event_frame; | 204 | Lisp_Object Vlast_event_frame; |
| 198 | #endif | ||
| 199 | 205 | ||
| 200 | /* The timestamp of the last input event we received from the X server. | 206 | /* The timestamp of the last input event we received from the X server. |
| 201 | X Windows wants this for selection ownership. */ | 207 | X Windows wants this for selection ownership. */ |
| @@ -285,6 +291,8 @@ Lisp_Object Qhslider_part; | |||
| 285 | Lisp_Object Qhthumbleft_part; | 291 | Lisp_Object Qhthumbleft_part; |
| 286 | Lisp_Object Qhthumbright_part; | 292 | Lisp_Object Qhthumbright_part; |
| 287 | 293 | ||
| 294 | Lisp_Object Qswitch_frame; | ||
| 295 | |||
| 288 | /* Symbols to denote kinds of events. */ | 296 | /* Symbols to denote kinds of events. */ |
| 289 | Lisp_Object Qfunction_key; | 297 | Lisp_Object Qfunction_key; |
| 290 | Lisp_Object Qmouse_click; | 298 | Lisp_Object Qmouse_click; |
| @@ -842,12 +850,14 @@ command_loop_1 () | |||
| 842 | 850 | ||
| 843 | ++num_input_keys; | 851 | ++num_input_keys; |
| 844 | 852 | ||
| 853 | #if 0 /* This shouldn't be necessary, now that we have switch-frame events. */ | ||
| 845 | #ifdef MULTI_FRAME | 854 | #ifdef MULTI_FRAME |
| 846 | /* Select the frame that the key sequence came from. */ | 855 | /* Select the frame that the key sequence came from. */ |
| 847 | if (XTYPE (Vlast_event_frame) == Lisp_Frame | 856 | if (XTYPE (Vlast_event_frame) == Lisp_Frame |
| 848 | && XFRAME (Vlast_event_frame) != selected_frame) | 857 | && XFRAME (Vlast_event_frame) != selected_frame) |
| 849 | Fselect_frame (Vlast_event_frame, Qnil); | 858 | Fselect_frame (Vlast_event_frame, Qnil); |
| 850 | #endif | 859 | #endif |
| 860 | #endif | ||
| 851 | 861 | ||
| 852 | /* Now we have read a key sequence of length I, | 862 | /* Now we have read a key sequence of length I, |
| 853 | or else I is 0 and we found end of file. */ | 863 | or else I is 0 and we found end of file. */ |
| @@ -1136,6 +1146,16 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1136 | goto from_macro; | 1146 | goto from_macro; |
| 1137 | } | 1147 | } |
| 1138 | 1148 | ||
| 1149 | if (!NILP (unread_switch_frame)) | ||
| 1150 | { | ||
| 1151 | c = unread_switch_frame; | ||
| 1152 | unread_switch_frame = Qnil; | ||
| 1153 | |||
| 1154 | /* This event should make it into this_command_keys, and get echoed | ||
| 1155 | again, so we go to reread, rather than reread_first. */ | ||
| 1156 | goto reread; | ||
| 1157 | } | ||
| 1158 | |||
| 1139 | /* Save outer setjmp data, in case called recursively. */ | 1159 | /* Save outer setjmp data, in case called recursively. */ |
| 1140 | save_getcjmp (save_jump); | 1160 | save_getcjmp (save_jump); |
| 1141 | 1161 | ||
| @@ -1147,9 +1167,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 1147 | if (_setjmp (getcjmp)) | 1167 | if (_setjmp (getcjmp)) |
| 1148 | { | 1168 | { |
| 1149 | XSET (c, Lisp_Int, quit_char); | 1169 | XSET (c, Lisp_Int, quit_char); |
| 1150 | #ifdef MULTI_FRAME | ||
| 1151 | XSET (Vlast_event_frame, Lisp_Frame, selected_frame); | 1170 | XSET (Vlast_event_frame, Lisp_Frame, selected_frame); |
| 1152 | #endif | ||
| 1153 | 1171 | ||
| 1154 | goto non_reread; | 1172 | goto non_reread; |
| 1155 | } | 1173 | } |
| @@ -1462,13 +1480,11 @@ kbd_buffer_store_event (event) | |||
| 1462 | { | 1480 | { |
| 1463 | extern SIGTYPE interrupt_signal (); | 1481 | extern SIGTYPE interrupt_signal (); |
| 1464 | 1482 | ||
| 1465 | #ifdef MULTI_FRAME | ||
| 1466 | /* If this results in a quit_char being returned to Emacs as | 1483 | /* If this results in a quit_char being returned to Emacs as |
| 1467 | input, set last-event-frame properly. If this doesn't | 1484 | input, set last-event-frame properly. If this doesn't |
| 1468 | get returned to Emacs as an event, the next event read | 1485 | get returned to Emacs as an event, the next event read |
| 1469 | will set Vlast_event_frame again, so this is safe to do. */ | 1486 | will set Vlast_event_frame again, so this is safe to do. */ |
| 1470 | Vlast_event_frame = FRAME_FOCUS_FRAME (event->frame); | 1487 | Vlast_event_frame = FRAME_FOCUS_FRAME (event->frame); |
| 1471 | #endif | ||
| 1472 | 1488 | ||
| 1473 | last_event_timestamp = event->timestamp; | 1489 | last_event_timestamp = event->timestamp; |
| 1474 | interrupt_signal (); | 1490 | interrupt_signal (); |
| @@ -1509,6 +1525,7 @@ kbd_buffer_store_event (event) | |||
| 1509 | static Lisp_Object make_lispy_event (); | 1525 | static Lisp_Object make_lispy_event (); |
| 1510 | static Lisp_Object make_lispy_movement (); | 1526 | static Lisp_Object make_lispy_movement (); |
| 1511 | static Lisp_Object modify_event_symbol (); | 1527 | static Lisp_Object modify_event_symbol (); |
| 1528 | static Lisp_Object make_lispy_switch_frame (); | ||
| 1512 | 1529 | ||
| 1513 | static Lisp_Object | 1530 | static Lisp_Object |
| 1514 | kbd_buffer_get_event () | 1531 | kbd_buffer_get_event () |
| @@ -1564,20 +1581,34 @@ kbd_buffer_get_event () | |||
| 1564 | mouse movement enabled and available. */ | 1581 | mouse movement enabled and available. */ |
| 1565 | if (kbd_fetch_ptr != kbd_store_ptr) | 1582 | if (kbd_fetch_ptr != kbd_store_ptr) |
| 1566 | { | 1583 | { |
| 1567 | if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE) | 1584 | struct input_event *event; |
| 1568 | kbd_fetch_ptr = kbd_buffer; | 1585 | Lisp_Object frame; |
| 1569 | 1586 | ||
| 1570 | #ifdef MULTI_FRAME | 1587 | event = ((kbd_fetch_ptr <= kbd_buffer + KBD_BUFFER_SIZE) |
| 1571 | XSET (Vlast_event_frame, Lisp_Frame, | 1588 | ? kbd_fetch_ptr |
| 1572 | XFRAME (FRAME_FOCUS_FRAME (kbd_fetch_ptr->frame))); | 1589 | : kbd_buffer); |
| 1573 | #endif | ||
| 1574 | 1590 | ||
| 1575 | last_event_timestamp = kbd_fetch_ptr->timestamp; | 1591 | last_event_timestamp = event->timestamp; |
| 1576 | obj = make_lispy_event (kbd_fetch_ptr); | 1592 | XSET (frame, Lisp_Frame, XFRAME (FRAME_FOCUS_FRAME (event->frame))); |
| 1577 | kbd_fetch_ptr->kind = no_event; | 1593 | |
| 1578 | kbd_fetch_ptr++; | 1594 | /* If this event is on a different frame, return a switch-frame this |
| 1579 | if (XTYPE (obj) == Lisp_Int) | 1595 | time, and leave the event in the queue for next time. */ |
| 1580 | XSET (obj, Lisp_Int, XINT (obj) & (meta_key ? 0377 : 0177)); | 1596 | if (! EQ (frame, Vlast_event_frame)) |
| 1597 | { | ||
| 1598 | Vlast_event_frame = frame; | ||
| 1599 | obj = make_lispy_switch_frame (frame); | ||
| 1600 | } | ||
| 1601 | else | ||
| 1602 | { | ||
| 1603 | obj = make_lispy_event (event); | ||
| 1604 | if (XTYPE (obj) == Lisp_Int) | ||
| 1605 | XSET (obj, Lisp_Int, XINT (obj) & (meta_key ? 0377 : 0177)); | ||
| 1606 | |||
| 1607 | /* Wipe out this event, to catch bugs. */ | ||
| 1608 | event->kind = no_event; | ||
| 1609 | |||
| 1610 | kbd_fetch_ptr = event + 1; | ||
| 1611 | } | ||
| 1581 | } | 1612 | } |
| 1582 | else if (do_mouse_tracking && mouse_moved) | 1613 | else if (do_mouse_tracking && mouse_moved) |
| 1583 | { | 1614 | { |
| @@ -1586,11 +1617,14 @@ kbd_buffer_get_event () | |||
| 1586 | unsigned long time; | 1617 | unsigned long time; |
| 1587 | 1618 | ||
| 1588 | (*mouse_position_hook) (&frame, &x, &y, &time); | 1619 | (*mouse_position_hook) (&frame, &x, &y, &time); |
| 1589 | #ifdef MULTI_FRAME | ||
| 1590 | XSET (Vlast_event_frame, Lisp_Frame, frame); | ||
| 1591 | #endif | ||
| 1592 | 1620 | ||
| 1593 | obj = make_lispy_movement (frame, x, y, time); | 1621 | if (frame != XFRAME (Vlast_event_frame)) |
| 1622 | { | ||
| 1623 | XSET (Vlast_event_frame, Lisp_Frame, frame); | ||
| 1624 | obj = make_lispy_switch_frame (Vlast_event_frame); | ||
| 1625 | } | ||
| 1626 | else | ||
| 1627 | obj = make_lispy_movement (frame, x, y, time); | ||
| 1594 | } | 1628 | } |
| 1595 | else | 1629 | else |
| 1596 | /* We were promised by the above while loop that there was | 1630 | /* We were promised by the above while loop that there was |
| @@ -1898,6 +1932,14 @@ make_lispy_movement (frame, x, y, time) | |||
| 1898 | } | 1932 | } |
| 1899 | 1933 | ||
| 1900 | 1934 | ||
| 1935 | /* Construct a switch frame event. */ | ||
| 1936 | static Lisp_Object | ||
| 1937 | make_lispy_switch_frame (frame) | ||
| 1938 | Lisp_Object frame; | ||
| 1939 | { | ||
| 1940 | return Fcons (Qswitch_frame, Fcons (frame, Qnil)); | ||
| 1941 | } | ||
| 1942 | |||
| 1901 | 1943 | ||
| 1902 | /* Manipulating modifiers. */ | 1944 | /* Manipulating modifiers. */ |
| 1903 | 1945 | ||
| @@ -2122,7 +2164,10 @@ parse_modifiers (symbol) | |||
| 2122 | 2164 | ||
| 2123 | This is like apply_modifiers_uncached, but uses BASE's | 2165 | This is like apply_modifiers_uncached, but uses BASE's |
| 2124 | Qmodifier_cache property, if present. It also builds | 2166 | Qmodifier_cache property, if present. It also builds |
| 2125 | Qevent_symbol_elements properties, since it has that info anyway. */ | 2167 | Qevent_symbol_elements properties, since it has that info anyway. |
| 2168 | |||
| 2169 | apply_modifiers copies the value of BASE's Qevent_kind property to | ||
| 2170 | the modified symbol. */ | ||
| 2126 | static Lisp_Object | 2171 | static Lisp_Object |
| 2127 | apply_modifiers (modifiers, base) | 2172 | apply_modifiers (modifiers, base) |
| 2128 | int modifiers; | 2173 | int modifiers; |
| @@ -2131,8 +2176,8 @@ apply_modifiers (modifiers, base) | |||
| 2131 | Lisp_Object cache, index, entry; | 2176 | Lisp_Object cache, index, entry; |
| 2132 | 2177 | ||
| 2133 | /* The click modifier never figures into cache indices. */ | 2178 | /* The click modifier never figures into cache indices. */ |
| 2134 | XFASTINT (index) = (modifiers & ~click_modifier); | ||
| 2135 | cache = Fget (base, Qmodifier_cache); | 2179 | cache = Fget (base, Qmodifier_cache); |
| 2180 | XFASTINT (index) = (modifiers & ~click_modifier); | ||
| 2136 | entry = Fassq (index, cache); | 2181 | entry = Fassq (index, cache); |
| 2137 | 2182 | ||
| 2138 | if (CONSP (entry)) | 2183 | if (CONSP (entry)) |
| @@ -2156,6 +2201,9 @@ apply_modifiers (modifiers, base) | |||
| 2156 | Fput (new_symbol, Qevent_symbol_elements, | 2201 | Fput (new_symbol, Qevent_symbol_elements, |
| 2157 | Fcons (base, lispy_modifier_list (modifiers))); | 2202 | Fcons (base, lispy_modifier_list (modifiers))); |
| 2158 | 2203 | ||
| 2204 | /* This symbol is of the same kind as BASE. */ | ||
| 2205 | Fput (new_symbol, Qevent_kind, Fget (new_symbol, Qevent_kind)); | ||
| 2206 | |||
| 2159 | return new_symbol; | 2207 | return new_symbol; |
| 2160 | } | 2208 | } |
| 2161 | } | 2209 | } |
| @@ -2710,8 +2758,8 @@ follow_key (key, nmaps, current, defs, next) | |||
| 2710 | for (i = 0; i < nmaps; i++) | 2758 | for (i = 0; i < nmaps; i++) |
| 2711 | if (! NILP (current[i])) | 2759 | if (! NILP (current[i])) |
| 2712 | { | 2760 | { |
| 2713 | next[i] = get_keyelt (access_keymap (current[i], | 2761 | next[i] = |
| 2714 | meta_prefix_char)); | 2762 | get_keyelt (access_keymap (current[i], meta_prefix_char, 1)); |
| 2715 | 2763 | ||
| 2716 | /* Note that since we pass the resulting bindings through | 2764 | /* Note that since we pass the resulting bindings through |
| 2717 | get_keymap_1, non-prefix bindings for meta-prefix-char | 2765 | get_keymap_1, non-prefix bindings for meta-prefix-char |
| @@ -2730,7 +2778,7 @@ follow_key (key, nmaps, current, defs, next) | |||
| 2730 | { | 2778 | { |
| 2731 | if (! NILP (current[i])) | 2779 | if (! NILP (current[i])) |
| 2732 | { | 2780 | { |
| 2733 | defs[i] = get_keyelt (access_keymap (current[i], key)); | 2781 | defs[i] = get_keyelt (access_keymap (current[i], key, 1)); |
| 2734 | if (! NILP (defs[i])) | 2782 | if (! NILP (defs[i])) |
| 2735 | first_binding = i; | 2783 | first_binding = i; |
| 2736 | } | 2784 | } |
| @@ -2752,7 +2800,7 @@ follow_key (key, nmaps, current, defs, next) | |||
| 2752 | { | 2800 | { |
| 2753 | if (! NILP (current[i])) | 2801 | if (! NILP (current[i])) |
| 2754 | { | 2802 | { |
| 2755 | defs[i] = get_keyelt (access_keymap (current[i], key)); | 2803 | defs[i] = get_keyelt (access_keymap (current[i], key, 1)); |
| 2756 | if (! NILP (defs[i])) | 2804 | if (! NILP (defs[i])) |
| 2757 | first_binding = i; | 2805 | first_binding = i; |
| 2758 | } | 2806 | } |
| @@ -2843,6 +2891,10 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 2843 | int fkey_start = 0, fkey_end = 0; | 2891 | int fkey_start = 0, fkey_end = 0; |
| 2844 | Lisp_Object fkey_map = Vfunction_key_map; | 2892 | Lisp_Object fkey_map = Vfunction_key_map; |
| 2845 | 2893 | ||
| 2894 | /* If we receive a ``switch-frame'' event in the middle of a key sequence, | ||
| 2895 | we put it off for later. While we're reading, we keep the event here. */ | ||
| 2896 | Lisp_Object delayed_switch_frame = Qnil; | ||
| 2897 | |||
| 2846 | last_nonmenu_event = Qnil; | 2898 | last_nonmenu_event = Qnil; |
| 2847 | 2899 | ||
| 2848 | if (INTERACTIVE) | 2900 | if (INTERACTIVE) |
| @@ -2935,30 +2987,49 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 2935 | Emacs 18 handles this by returning immediately with a | 2987 | Emacs 18 handles this by returning immediately with a |
| 2936 | zero, so that's what we'll do. */ | 2988 | zero, so that's what we'll do. */ |
| 2937 | if (XTYPE (key) == Lisp_Int && XINT (key) < 0) | 2989 | if (XTYPE (key) == Lisp_Int && XINT (key) < 0) |
| 2938 | return 0; | 2990 | { |
| 2991 | unread_switch_frame = delayed_switch_frame; | ||
| 2992 | return 0; | ||
| 2993 | } | ||
| 2939 | 2994 | ||
| 2940 | Vquit_flag = Qnil; | 2995 | Vquit_flag = Qnil; |
| 2941 | 2996 | ||
| 2942 | /* Clicks in non-text areas get prefixed by the symbol | 2997 | /* Clicks in non-text areas get prefixed by the symbol |
| 2943 | in their CHAR-ADDRESS field. For example, a click on | 2998 | in their CHAR-ADDRESS field. For example, a click on |
| 2944 | the mode line is prefixed by the symbol `mode-line'. */ | 2999 | the mode line is prefixed by the symbol `mode-line'. */ |
| 2945 | if (EVENT_HAS_PARAMETERS (key) | 3000 | if (EVENT_HAS_PARAMETERS (key)) |
| 2946 | && EQ (EVENT_HEAD_KIND (EVENT_HEAD (key)), Qmouse_click)) | ||
| 2947 | { | 3001 | { |
| 2948 | Lisp_Object posn = POSN_BUFFER_POSN (EVENT_START (key)); | 3002 | Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (key)); |
| 2949 | 3003 | if (EQ (kind, Qmouse_click)) | |
| 2950 | if (XTYPE (posn) == Lisp_Symbol) | ||
| 2951 | { | 3004 | { |
| 2952 | if (t + 1 >= bufsize) | 3005 | Lisp_Object posn = POSN_BUFFER_POSN (EVENT_START (key)); |
| 2953 | error ("key sequence too long"); | ||
| 2954 | keybuf[t] = posn; | ||
| 2955 | keybuf[t+1] = key; | ||
| 2956 | mock_input = t + 2; | ||
| 2957 | 3006 | ||
| 2958 | goto retry_key; | 3007 | if (XTYPE (posn) == Lisp_Symbol) |
| 3008 | { | ||
| 3009 | if (t + 1 >= bufsize) | ||
| 3010 | error ("key sequence too long"); | ||
| 3011 | keybuf[t] = posn; | ||
| 3012 | keybuf[t+1] = key; | ||
| 3013 | mock_input = t + 2; | ||
| 3014 | |||
| 3015 | goto retry_key; | ||
| 3016 | } | ||
| 3017 | } | ||
| 3018 | else if (EQ (kind, Qswitch_frame)) | ||
| 3019 | { | ||
| 3020 | /* If we're at the beginning of a key sequence, go | ||
| 3021 | ahead and return this event. If we're in the | ||
| 3022 | midst of a key sequence, delay it until the end. */ | ||
| 3023 | if (t > 0) | ||
| 3024 | { | ||
| 3025 | delayed_switch_frame = key; | ||
| 3026 | goto retry_key; | ||
| 3027 | } | ||
| 2959 | } | 3028 | } |
| 2960 | } | 3029 | } |
| 2961 | 3030 | ||
| 3031 | #if 0 /* This shouldn't be necessary any more, now that we have | ||
| 3032 | switch-frame events. */ | ||
| 2962 | #ifdef MULTI_FRAME | 3033 | #ifdef MULTI_FRAME |
| 2963 | /* What buffer was this event typed/moused at? */ | 3034 | /* What buffer was this event typed/moused at? */ |
| 2964 | if (used_mouse_menu) | 3035 | if (used_mouse_menu) |
| @@ -2999,7 +3070,8 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 2999 | 3070 | ||
| 3000 | goto restart; | 3071 | goto restart; |
| 3001 | } | 3072 | } |
| 3002 | #endif | 3073 | #endif /* MULTI_FRAME */ |
| 3074 | #endif /* 0 */ | ||
| 3003 | } | 3075 | } |
| 3004 | 3076 | ||
| 3005 | first_binding = (follow_key (key, | 3077 | first_binding = (follow_key (key, |
| @@ -3087,15 +3159,16 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 3087 | with meta_prefix_char. I hate this. */ | 3159 | with meta_prefix_char. I hate this. */ |
| 3088 | if (keybuf[fkey_end] & 0x80) | 3160 | if (keybuf[fkey_end] & 0x80) |
| 3089 | fkey_next = | 3161 | fkey_next = |
| 3090 | get_keymap_1 (get_keyelt | 3162 | get_keymap_1 |
| 3091 | (access_keymap (fkey_map, meta_prefix_char)), | 3163 | ((get_keyelt |
| 3092 | 0); | 3164 | (access_keymap (fkey_map, meta_prefix_char, 1))), |
| 3165 | 0); | ||
| 3093 | else | 3166 | else |
| 3094 | fkey_next = fkey_map; | 3167 | fkey_next = fkey_map; |
| 3095 | 3168 | ||
| 3096 | fkey_next = | 3169 | fkey_next = |
| 3097 | get_keyelt (access_keymap | 3170 | get_keyelt (access_keymap |
| 3098 | (fkey_next, keybuf[fkey_end++] & 0x7f)); | 3171 | (fkey_next, keybuf[fkey_end++] & 0x7f, 1)); |
| 3099 | 3172 | ||
| 3100 | /* If keybuf[fkey_start..fkey_end] is bound in the | 3173 | /* If keybuf[fkey_start..fkey_end] is bound in the |
| 3101 | function key map and it's a suffix of the current | 3174 | function key map and it's a suffix of the current |
| @@ -3135,6 +3208,7 @@ read_key_sequence (keybuf, bufsize, prompt) | |||
| 3135 | ? defs[first_binding] | 3208 | ? defs[first_binding] |
| 3136 | : Qnil); | 3209 | : Qnil); |
| 3137 | 3210 | ||
| 3211 | unread_switch_frame = delayed_switch_frame; | ||
| 3138 | return t; | 3212 | return t; |
| 3139 | } | 3213 | } |
| 3140 | 3214 | ||
| @@ -3773,7 +3847,8 @@ struct event_head head_table[] = { | |||
| 3773 | &Qhscrollbar_part, "hscrollbar-part", &Qscrollbar_click, | 3847 | &Qhscrollbar_part, "hscrollbar-part", &Qscrollbar_click, |
| 3774 | &Qhslider_part, "hslider-part", &Qscrollbar_click, | 3848 | &Qhslider_part, "hslider-part", &Qscrollbar_click, |
| 3775 | &Qhthumbleft_part, "hthumbleft-part", &Qscrollbar_click, | 3849 | &Qhthumbleft_part, "hthumbleft-part", &Qscrollbar_click, |
| 3776 | &Qhthumbright_part,"hthumbright-part", &Qscrollbar_click | 3850 | &Qhthumbright_part,"hthumbright-part", &Qscrollbar_click, |
| 3851 | &Qswitch_frame, "switch-frame", &Qswitch_frame | ||
| 3777 | }; | 3852 | }; |
| 3778 | 3853 | ||
| 3779 | syms_of_keyboard () | 3854 | syms_of_keyboard () |
| @@ -3802,7 +3877,7 @@ syms_of_keyboard () | |||
| 3802 | Qvertical_line = intern ("vertical-line"); | 3877 | Qvertical_line = intern ("vertical-line"); |
| 3803 | staticpro (&Qvertical_line); | 3878 | staticpro (&Qvertical_line); |
| 3804 | 3879 | ||
| 3805 | Qevent_kind = intern ("event-type"); | 3880 | Qevent_kind = intern ("event-kind"); |
| 3806 | staticpro (&Qevent_kind); | 3881 | staticpro (&Qevent_kind); |
| 3807 | Qevent_symbol_elements = intern ("event-symbol-elements"); | 3882 | Qevent_symbol_elements = intern ("event-symbol-elements"); |
| 3808 | staticpro (&Qevent_symbol_elements); | 3883 | staticpro (&Qevent_symbol_elements); |
| @@ -3851,6 +3926,9 @@ syms_of_keyboard () | |||
| 3851 | mouse_syms = Qnil; | 3926 | mouse_syms = Qnil; |
| 3852 | staticpro (&mouse_syms); | 3927 | staticpro (&mouse_syms); |
| 3853 | 3928 | ||
| 3929 | unread_switch_frame = Qnil; | ||
| 3930 | staticpro (&unread_switch_frame); | ||
| 3931 | |||
| 3854 | defsubr (&Sread_key_sequence); | 3932 | defsubr (&Sread_key_sequence); |
| 3855 | defsubr (&Srecursive_edit); | 3933 | defsubr (&Srecursive_edit); |
| 3856 | defsubr (&Strack_mouse); | 3934 | defsubr (&Strack_mouse); |
| @@ -3932,12 +4010,10 @@ Polling is automatically disabled in all other cases."); | |||
| 3932 | "*Number of complete keys read from the keyboard so far."); | 4010 | "*Number of complete keys read from the keyboard so far."); |
| 3933 | num_input_keys = 0; | 4011 | num_input_keys = 0; |
| 3934 | 4012 | ||
| 3935 | #ifdef MULTI_FRAME | ||
| 3936 | DEFVAR_LISP ("last-event-frame", &Vlast_event_frame, | 4013 | DEFVAR_LISP ("last-event-frame", &Vlast_event_frame, |
| 3937 | "*The frame in which the most recently read event occurred.\n\ | 4014 | "*The frame in which the most recently read event occurred.\n\ |
| 3938 | If the last event came from a keyboard macro, this is set to `macro'."); | 4015 | If the last event came from a keyboard macro, this is set to `macro'."); |
| 3939 | Vlast_event_frame = Qnil; | 4016 | Vlast_event_frame = Qnil; |
| 3940 | #endif | ||
| 3941 | 4017 | ||
| 3942 | DEFVAR_LISP ("help-char", &help_char, | 4018 | DEFVAR_LISP ("help-char", &help_char, |
| 3943 | "Character to recognize as meaning Help.\n\ | 4019 | "Character to recognize as meaning Help.\n\ |