aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1992-11-07 07:07:16 +0000
committerJim Blandy1992-11-07 07:07:16 +0000
commit07d2b8de62d7ad850f520f4ded372ddcba31c141 (patch)
tree5eb446532e05d924280f6c4a856184d74a629340 /src
parentee9ee63cfadc62d9f31c119922deef92eca01164 (diff)
downloademacs-07d2b8de62d7ad850f520f4ded372ddcba31c141.tar.gz
emacs-07d2b8de62d7ad850f520f4ded372ddcba31c141.zip
* keyboard.c (read_key_sequence): Removed the
replay_sequence_new_buffer label; replay_sequence should be here instead. * keyboard.c (Vlast_event_frame): Arrange for this to exist iff MULTI_FRAME is defined. [not MULTI_FRAME] (syms_of_keyboard): Don't DEFVAR Vlast_event_frame. [not MULTI_FRAME] (read_char): Don't try to set Vlast_event_frame. [not MULTI_FRAME] (kbd_buffer_store_event): Don't try to set Vlast_event_frame for quit characters. [not MULTI_FRAME] (kbd_buffer_get_event): Don't try to generate switch-frame events.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c75
1 files changed, 48 insertions, 27 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index b107c1cc3c8..f816a2b97c6 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -198,16 +198,15 @@ Lisp_Object last_command;
198 instead of the actual command. */ 198 instead of the actual command. */
199Lisp_Object this_command; 199Lisp_Object this_command;
200 200
201#ifdef MULTI_FRAME
201/* The frame in which the last input event occurred, or Qmacro if the 202/* The frame in which the last input event occurred, or Qmacro if the
202 last event came from a macro. 203 last event came from a macro.
203 command_loop_1 will select this frame before running the 204 command_loop_1 will select this frame before running the
204 command bound to an event sequence, and read_key_sequence will 205 command bound to an event sequence, and read_key_sequence will
205 toss the existing prefix if the user starts typing at a 206 toss the existing prefix if the user starts typing at a
206 new frame. 207 new frame. */
207
208 On a non-multi-frame Emacs, this will be either Qmacro or
209 selected_frame. */
210Lisp_Object Vlast_event_frame; 208Lisp_Object Vlast_event_frame;
209#endif
211 210
212/* The timestamp of the last input event we received from the X server. 211/* The timestamp of the last input event we received from the X server.
213 X Windows wants this for selection ownership. */ 212 X Windows wants this for selection ownership. */
@@ -1135,6 +1134,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1135 1134
1136 if (!NILP (Vexecuting_macro)) 1135 if (!NILP (Vexecuting_macro))
1137 { 1136 {
1137#ifdef MULTI_FRAME
1138 /* We set this to Qmacro; since that's not a frame, nobody will 1138 /* We set this to Qmacro; since that's not a frame, nobody will
1139 try to switch frames on us, and the selected window will 1139 try to switch frames on us, and the selected window will
1140 remain unchanged. 1140 remain unchanged.
@@ -1145,6 +1145,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1145 Vlast_event_frame after each command is read, but events read 1145 Vlast_event_frame after each command is read, but events read
1146 from a macro should never cause a new frame to be selected. */ 1146 from a macro should never cause a new frame to be selected. */
1147 Vlast_event_frame = Qmacro; 1147 Vlast_event_frame = Qmacro;
1148#endif
1148 1149
1149 if (executing_macro_index >= XFASTINT (Flength (Vexecuting_macro))) 1150 if (executing_macro_index >= XFASTINT (Flength (Vexecuting_macro)))
1150 { 1151 {
@@ -1179,7 +1180,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1179 if (_setjmp (getcjmp)) 1180 if (_setjmp (getcjmp))
1180 { 1181 {
1181 XSET (c, Lisp_Int, quit_char); 1182 XSET (c, Lisp_Int, quit_char);
1183#ifdef MULTI_FRAME
1182 XSET (Vlast_event_frame, Lisp_Frame, selected_frame); 1184 XSET (Vlast_event_frame, Lisp_Frame, selected_frame);
1185#endif
1183 1186
1184 goto non_reread; 1187 goto non_reread;
1185 } 1188 }
@@ -1492,11 +1495,13 @@ kbd_buffer_store_event (event)
1492 { 1495 {
1493 extern SIGTYPE interrupt_signal (); 1496 extern SIGTYPE interrupt_signal ();
1494 1497
1498#ifdef MULTI_FRAME
1495 /* If this results in a quit_char being returned to Emacs as 1499 /* If this results in a quit_char being returned to Emacs as
1496 input, set last-event-frame properly. If this doesn't 1500 input, set last-event-frame properly. If this doesn't
1497 get returned to Emacs as an event, the next event read 1501 get returned to Emacs as an event, the next event read
1498 will set Vlast_event_frame again, so this is safe to do. */ 1502 will set Vlast_event_frame again, so this is safe to do. */
1499 Vlast_event_frame = FRAME_FOCUS_FRAME (event->frame); 1503 Vlast_event_frame = FRAME_FOCUS_FRAME (event->frame);
1504#endif
1500 1505
1501 last_event_timestamp = event->timestamp; 1506 last_event_timestamp = event->timestamp;
1502 interrupt_signal (); 1507 interrupt_signal ();
@@ -1594,33 +1599,38 @@ kbd_buffer_get_event ()
1594 if (kbd_fetch_ptr != kbd_store_ptr) 1599 if (kbd_fetch_ptr != kbd_store_ptr)
1595 { 1600 {
1596 struct input_event *event; 1601 struct input_event *event;
1597 Lisp_Object frame;
1598 1602
1599 event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE) 1603 event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)
1600 ? kbd_fetch_ptr 1604 ? kbd_fetch_ptr
1601 : kbd_buffer); 1605 : kbd_buffer);
1602 1606
1603 last_event_timestamp = event->timestamp; 1607 last_event_timestamp = event->timestamp;
1604 XSET (frame, Lisp_Frame, XFRAME (FRAME_FOCUS_FRAME (event->frame)));
1605 1608
1606 /* If this event is on a different frame, return a switch-frame this 1609 {
1607 time, and leave the event in the queue for next time. */ 1610#ifdef MULTI_FRAME
1608 if (! EQ (frame, Vlast_event_frame)) 1611 Lisp_Object frame;
1609 { 1612
1610 Vlast_event_frame = frame; 1613 /* If this event is on a different frame, return a switch-frame this
1611 obj = make_lispy_switch_frame (frame); 1614 time, and leave the event in the queue for next time. */
1612 } 1615 XSET (frame, Lisp_Frame, XFRAME (FRAME_FOCUS_FRAME (event->frame)));
1613 else 1616 if (! EQ (frame, Vlast_event_frame))
1614 { 1617 {
1615 obj = make_lispy_event (event); 1618 Vlast_event_frame = frame;
1616 if (XTYPE (obj) == Lisp_Int) 1619 obj = make_lispy_switch_frame (frame);
1617 XSET (obj, Lisp_Int, XINT (obj) & (meta_key ? 0377 : 0177)); 1620 }
1621 else
1622#endif
1623 {
1624 obj = make_lispy_event (event);
1625 if (XTYPE (obj) == Lisp_Int)
1626 XSET (obj, Lisp_Int, XINT (obj) & (meta_key ? 0377 : 0177));
1618 1627
1619 /* Wipe out this event, to catch bugs. */ 1628 /* Wipe out this event, to catch bugs. */
1620 event->kind = no_event; 1629 event->kind = no_event;
1621 1630
1622 kbd_fetch_ptr = event + 1; 1631 kbd_fetch_ptr = event + 1;
1623 } 1632 }
1633 }
1624 } 1634 }
1625 else if (do_mouse_tracking && mouse_moved) 1635 else if (do_mouse_tracking && mouse_moved)
1626 { 1636 {
@@ -1630,6 +1640,7 @@ kbd_buffer_get_event ()
1630 1640
1631 (*mouse_position_hook) (&frame, &x, &y, &time); 1641 (*mouse_position_hook) (&frame, &x, &y, &time);
1632 1642
1643#ifdef MULTI_FRAME
1633 /* Decide if we should generate a switch-frame event. Don't generate 1644 /* Decide if we should generate a switch-frame event. Don't generate
1634 switch-frame events for motion outside of all Emacs frames. */ 1645 switch-frame events for motion outside of all Emacs frames. */
1635 if (frame && frame != XFRAME (Vlast_event_frame)) 1646 if (frame && frame != XFRAME (Vlast_event_frame))
@@ -1638,6 +1649,7 @@ kbd_buffer_get_event ()
1638 obj = make_lispy_switch_frame (Vlast_event_frame); 1649 obj = make_lispy_switch_frame (Vlast_event_frame);
1639 } 1650 }
1640 else 1651 else
1652#endif
1641 obj = make_lispy_movement (frame, x, y, time); 1653 obj = make_lispy_movement (frame, x, y, time);
1642 } 1654 }
1643 else 1655 else
@@ -2954,10 +2966,12 @@ read_key_sequence (keybuf, bufsize, prompt)
2954 echo_start = echo_length (); 2966 echo_start = echo_length ();
2955 keys_start = this_command_key_count; 2967 keys_start = this_command_key_count;
2956 2968
2957 replay_sequence_new_buffer: 2969 replay_sequence:
2958 /* Build our list of keymaps. 2970 /* Build our list of keymaps.
2959 If the sequence starts with a mouse click, we may need to switch buffers 2971 If we recognize a function key and replace its escape sequence in
2960 and jump back here; that's what replay_sequence_new_buffer is for. */ 2972 keybuf with its symbol, or if the sequence starts with a mouse
2973 click and we need to switch buffers, we jump back here to rebuild
2974 the initial keymaps from the current buffer. */
2961 { 2975 {
2962 Lisp_Object *maps; 2976 Lisp_Object *maps;
2963 2977
@@ -2978,7 +2992,6 @@ read_key_sequence (keybuf, bufsize, prompt)
2978 if (! NILP (submaps[first_binding])) 2992 if (! NILP (submaps[first_binding]))
2979 break; 2993 break;
2980 2994
2981 replay_sequence:
2982 /* We jump here when a function key substitution has forced us to 2995 /* We jump here when a function key substitution has forced us to
2983 reprocess the current key sequence. keybuf[0..mock_input] is the 2996 reprocess the current key sequence. keybuf[0..mock_input] is the
2984 sequence we want to reread. */ 2997 sequence we want to reread. */
@@ -3089,7 +3102,7 @@ read_key_sequence (keybuf, bufsize, prompt)
3089 } 3102 }
3090 3103
3091 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); 3104 set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
3092 goto replay_sequence_new_buffer; 3105 goto replay_sequence;
3093 } 3106 }
3094 else if (XTYPE (posn) == Lisp_Symbol) 3107 else if (XTYPE (posn) == Lisp_Symbol)
3095 { 3108 {
@@ -3851,6 +3864,12 @@ init_keyboard ()
3851 do_mouse_tracking = 0; 3864 do_mouse_tracking = 0;
3852 input_pending = 0; 3865 input_pending = 0;
3853 3866
3867#ifdef MULTI_FRAME
3868 /* This means that we don't get a switch-frame event before the first
3869 character typed. */
3870 XSET (Vlast_event_frame, Lisp_Frame, selected_frame);
3871#endif
3872
3854 if (!noninteractive) 3873 if (!noninteractive)
3855 { 3874 {
3856 signal (SIGINT, interrupt_signal); 3875 signal (SIGINT, interrupt_signal);
@@ -4074,10 +4093,12 @@ Polling is automatically disabled in all other cases.");
4074 "*Number of complete keys read from the keyboard so far."); 4093 "*Number of complete keys read from the keyboard so far.");
4075 num_input_keys = 0; 4094 num_input_keys = 0;
4076 4095
4096#ifdef MULTI_FRAME
4077 DEFVAR_LISP ("last-event-frame", &Vlast_event_frame, 4097 DEFVAR_LISP ("last-event-frame", &Vlast_event_frame,
4078 "*The frame in which the most recently read event occurred.\n\ 4098 "*The frame in which the most recently read event occurred.\n\
4079If the last event came from a keyboard macro, this is set to `macro'."); 4099If the last event came from a keyboard macro, this is set to `macro'.");
4080 Vlast_event_frame = Qnil; 4100 Vlast_event_frame = Qnil;
4101#endif
4081 4102
4082 DEFVAR_LISP ("help-char", &help_char, 4103 DEFVAR_LISP ("help-char", &help_char,
4083 "Character to recognize as meaning Help.\n\ 4104 "Character to recognize as meaning Help.\n\