comparison src/keyboard.c @ 10903:ff1b5efecdb0

(read_key_sequence): New arg can_return_switch_frame. All callers changed. (Fread_key_sequence): Likewise.
author Karl Heuer <kwzh@gnu.org>
date Fri, 03 Mar 1995 01:50:42 +0000
parents 655e3daa560c
children 70de58691fd2
comparison
equal deleted inserted replaced
10902:a8ec3a55a1d9 10903:ff1b5efecdb0
1096 if (! NILP (Vlucid_menu_bar_dirty_flag) 1096 if (! NILP (Vlucid_menu_bar_dirty_flag)
1097 && !NILP (Ffboundp (Qrecompute_lucid_menubar))) 1097 && !NILP (Ffboundp (Qrecompute_lucid_menubar)))
1098 call0 (Qrecompute_lucid_menubar); 1098 call0 (Qrecompute_lucid_menubar);
1099 1099
1100 /* Read next key sequence; i gets its length. */ 1100 /* Read next key sequence; i gets its length. */
1101 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], Qnil, 0); 1101 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0],
1102 Qnil, 0, 1);
1102 1103
1103 ++num_input_keys; 1104 ++num_input_keys;
1104 1105
1105 /* Now we have read a key sequence of length I, 1106 /* Now we have read a key sequence of length I,
1106 or else I is 0 and we found end of file. */ 1107 or else I is 0 and we found end of file. */
4796 If the user switches frames in the midst of a key sequence, we put 4797 If the user switches frames in the midst of a key sequence, we put
4797 off the switch-frame event until later; the next call to 4798 off the switch-frame event until later; the next call to
4798 read_char will return it. */ 4799 read_char will return it. */
4799 4800
4800 static int 4801 static int
4801 read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last) 4802 read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
4803 can_return_switch_frame)
4802 Lisp_Object *keybuf; 4804 Lisp_Object *keybuf;
4803 int bufsize; 4805 int bufsize;
4804 Lisp_Object prompt; 4806 Lisp_Object prompt;
4805 int dont_downcase_last; 4807 int dont_downcase_last;
4808 int can_return_switch_frame;
4806 { 4809 {
4807 int count = specpdl_ptr - specpdl; 4810 int count = specpdl_ptr - specpdl;
4808 4811
4809 /* How many keys there are in the current key sequence. */ 4812 /* How many keys there are in the current key sequence. */
4810 int t; 4813 int t;
5226 goto replay_key; 5229 goto replay_key;
5227 } 5230 }
5228 } 5231 }
5229 else if (EQ (kind, Qswitch_frame)) 5232 else if (EQ (kind, Qswitch_frame))
5230 { 5233 {
5231 /* If we're at the beginning of a key sequence, go 5234 /* If we're at the beginning of a key sequence, and the caller
5232 ahead and return this event. If we're in the 5235 says it's okay, go ahead and return this event. If we're
5233 midst of a key sequence, delay it until the end. */ 5236 in the midst of a key sequence, delay it until the end. */
5234 if (t > 0) 5237 if (t > 0 || !can_return_switch_frame)
5235 { 5238 {
5236 delayed_switch_frame = key; 5239 delayed_switch_frame = key;
5237 goto replay_key; 5240 goto replay_key;
5238 } 5241 }
5239 } 5242 }
5715 return t; 5718 return t;
5716 } 5719 }
5717 5720
5718 #if 0 /* This doc string is too long for some compilers. 5721 #if 0 /* This doc string is too long for some compilers.
5719 This commented-out definition serves for DOC. */ 5722 This commented-out definition serves for DOC. */
5720 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 2, 0, 5723 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 4, 0,
5721 "Read a sequence of keystrokes and return as a string or vector.\n\ 5724 "Read a sequence of keystrokes and return as a string or vector.\n\
5722 The sequence is sufficient to specify a non-prefix command in the\n\ 5725 The sequence is sufficient to specify a non-prefix command in the\n\
5723 current local and global maps.\n\ 5726 current local and global maps.\n\
5724 \n\ 5727 \n\
5725 First arg PROMPT is a prompt string. If nil, do not prompt specially.\n\ 5728 First arg PROMPT is a prompt string. If nil, do not prompt specially.\n\
5748 \n\ 5751 \n\
5749 `read-key-sequence' prefixes mouse events on mode lines, the vertical\n\ 5752 `read-key-sequence' prefixes mouse events on mode lines, the vertical\n\
5750 lines separating windows, and scroll bars with imaginary keys\n\ 5753 lines separating windows, and scroll bars with imaginary keys\n\
5751 `mode-line', `vertical-line', and `vertical-scroll-bar'.\n\ 5754 `mode-line', `vertical-line', and `vertical-scroll-bar'.\n\
5752 \n\ 5755 \n\
5753 If the user switches frames in the middle of a key sequence, the\n\ 5756 Optional fourth argument CAN-RETURN-SWITCH-FRAME non-nil means that this\n\
5754 frame-switch event is put off until after the current key sequence.\n\ 5757 function will process a switch-frame event if the user switches frames\n\
5758 before typing anything. If the user switches frames in the middle of a\n\
5759 key sequence, or at the start of the sequence but CAN-RETURN-SWITCH-FRAME\n\
5760 is nil, then the event will be put off until after the current key sequence.\n\
5755 \n\ 5761 \n\
5756 `read-key-sequence' checks `function-key-map' for function key\n\ 5762 `read-key-sequence' checks `function-key-map' for function key\n\
5757 sequences, where they wouldn't conflict with ordinary bindings. See\n\ 5763 sequences, where they wouldn't conflict with ordinary bindings. See\n\
5758 `function-key-map' for more details.") 5764 `function-key-map' for more details.")
5759 (prompt, continue_echo) 5765 (prompt, continue_echo)
5760 #endif 5766 #endif
5761 5767
5762 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 3, 0, 5768 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 4, 0,
5763 0) 5769 0)
5764 (prompt, continue_echo, dont_downcase_last) 5770 (prompt, continue_echo, dont_downcase_last, can_return_switch_frame)
5765 Lisp_Object prompt, continue_echo, dont_downcase_last; 5771 Lisp_Object prompt, continue_echo, dont_downcase_last;
5772 Lisp_Object can_return_switch_frame;
5766 { 5773 {
5767 Lisp_Object keybuf[30]; 5774 Lisp_Object keybuf[30];
5768 register int i; 5775 register int i;
5769 struct gcpro gcpro1, gcpro2; 5776 struct gcpro gcpro1, gcpro2;
5770 5777
5778 5785
5779 if (NILP (continue_echo)) 5786 if (NILP (continue_echo))
5780 this_command_key_count = 0; 5787 this_command_key_count = 0;
5781 5788
5782 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), 5789 i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
5783 prompt, ! NILP (dont_downcase_last)); 5790 prompt, ! NILP (dont_downcase_last),
5791 ! NILP (can_return_switch_frame));
5784 5792
5785 if (i == -1) 5793 if (i == -1)
5786 { 5794 {
5787 Vquit_flag = Qt; 5795 Vquit_flag = Qt;
5788 QUIT; 5796 QUIT;