aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c127
1 files changed, 64 insertions, 63 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index c47fda8223c..8cfa4b34371 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1130,19 +1130,19 @@ void
1130push_frame_kboard (f) 1130push_frame_kboard (f)
1131 FRAME_PTR f; 1131 FRAME_PTR f;
1132{ 1132{
1133 push_kboard (f->device->kboard); 1133 push_kboard (f->terminal->kboard);
1134} 1134}
1135 1135
1136void 1136void
1137pop_kboard () 1137pop_kboard ()
1138{ 1138{
1139#ifdef MULTI_KBOARD 1139#ifdef MULTI_KBOARD
1140 struct device *d; 1140 struct terminal *t;
1141 struct kboard_stack *p = kboard_stack; 1141 struct kboard_stack *p = kboard_stack;
1142 current_kboard = NULL; 1142 current_kboard = NULL;
1143 for (d = device_list; d; d = d->next_device) 1143 for (t = terminal_list; t; t = t->next_terminal)
1144 { 1144 {
1145 if (d->kboard == p->kboard) 1145 if (t->kboard == p->kboard)
1146 { 1146 {
1147 current_kboard = p->kboard; 1147 current_kboard = p->kboard;
1148 break; 1148 break;
@@ -1150,7 +1150,7 @@ pop_kboard ()
1150 } 1150 }
1151 if (current_kboard == NULL) 1151 if (current_kboard == NULL)
1152 { 1152 {
1153 /* The display we remembered has been deleted. */ 1153 /* The terminal we remembered has been deleted. */
1154 current_kboard = FRAME_KBOARD (SELECTED_FRAME ()); 1154 current_kboard = FRAME_KBOARD (SELECTED_FRAME ());
1155 } 1155 }
1156 kboard_stack = p->next; 1156 kboard_stack = p->next;
@@ -4205,15 +4205,15 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
4205 unsigned long time; 4205 unsigned long time;
4206 4206
4207 *kbp = current_kboard; 4207 *kbp = current_kboard;
4208 /* Note that this uses F to determine which display to look at. 4208 /* Note that this uses F to determine which terminal to look at.
4209 If there is no valid info, it does not store anything 4209 If there is no valid info, it does not store anything
4210 so x remains nil. */ 4210 so x remains nil. */
4211 x = Qnil; 4211 x = Qnil;
4212 4212
4213 /* XXX Can f or mouse_position_hook be NULL here? */ 4213 /* XXX Can f or mouse_position_hook be NULL here? */
4214 if (f && FRAME_DEVICE (f)->mouse_position_hook) 4214 if (f && FRAME_TERMINAL (f)->mouse_position_hook)
4215 (*FRAME_DEVICE (f)->mouse_position_hook) (&f, 0, &bar_window, 4215 (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window,
4216 &part, &x, &y, &time); 4216 &part, &x, &y, &time);
4217 4217
4218 obj = Qnil; 4218 obj = Qnil;
4219 4219
@@ -6749,15 +6749,15 @@ read_avail_input (expected)
6749{ 6749{
6750 int nread = 0; 6750 int nread = 0;
6751 int err = 0; 6751 int err = 0;
6752 struct device *d; 6752 struct terminal *t;
6753 6753
6754 /* Loop through the available devices, and call their input hooks. */ 6754 /* Loop through the available terminals, and call their input hooks. */
6755 d = device_list; 6755 t = terminal_list;
6756 while (d) 6756 while (t)
6757 { 6757 {
6758 struct device *next = d->next_device; 6758 struct terminal *next = t->next_terminal;
6759 6759
6760 if (d->read_socket_hook) 6760 if (t->read_socket_hook)
6761 { 6761 {
6762 int nr; 6762 int nr;
6763 struct input_event hold_quit; 6763 struct input_event hold_quit;
@@ -6766,7 +6766,7 @@ read_avail_input (expected)
6766 hold_quit.kind = NO_EVENT; 6766 hold_quit.kind = NO_EVENT;
6767 6767
6768 /* No need for FIONREAD or fcntl; just say don't wait. */ 6768 /* No need for FIONREAD or fcntl; just say don't wait. */
6769 while (nr = (*d->read_socket_hook) (d, expected, &hold_quit), nr > 0) 6769 while (nr = (*t->read_socket_hook) (t, expected, &hold_quit), nr > 0)
6770 { 6770 {
6771 nread += nr; 6771 nread += nr;
6772 expected = 0; 6772 expected = 0;
@@ -6778,10 +6778,10 @@ read_avail_input (expected)
6778 } 6778 }
6779 else if (nr == -2) /* Non-transient error. */ 6779 else if (nr == -2) /* Non-transient error. */
6780 { 6780 {
6781 /* The display device terminated; it should be closed. */ 6781 /* The terminal device terminated; it should be closed. */
6782 6782
6783 /* Kill Emacs if this was our last display. */ 6783 /* Kill Emacs if this was our last terminal. */
6784 if (! device_list->next_device) 6784 if (!terminal_list->next_terminal)
6785 /* Formerly simply reported no input, but that 6785 /* Formerly simply reported no input, but that
6786 sometimes led to a failure of Emacs to terminate. 6786 sometimes led to a failure of Emacs to terminate.
6787 SIGHUP seems appropriate if we can't reach the 6787 SIGHUP seems appropriate if we can't reach the
@@ -6792,18 +6792,18 @@ read_avail_input (expected)
6792 alone in its group. */ 6792 alone in its group. */
6793 kill (getpid (), SIGHUP); 6793 kill (getpid (), SIGHUP);
6794 6794
6795 /* XXX Is calling delete_device safe here? It calls Fdelete_frame. */ 6795 /* XXX Is calling delete_terminal safe here? It calls Fdelete_frame. */
6796 if (d->delete_device_hook) 6796 if (t->delete_terminal_hook)
6797 (*d->delete_device_hook) (d); 6797 (*t->delete_terminal_hook) (t);
6798 else 6798 else
6799 delete_device (d); 6799 delete_terminal (t);
6800 } 6800 }
6801 6801
6802 if (hold_quit.kind != NO_EVENT) 6802 if (hold_quit.kind != NO_EVENT)
6803 kbd_buffer_store_event (&hold_quit); 6803 kbd_buffer_store_event (&hold_quit);
6804 } 6804 }
6805 6805
6806 d = next; 6806 t = next;
6807 } 6807 }
6808 6808
6809 if (err && !nread) 6809 if (err && !nread)
@@ -6814,12 +6814,12 @@ read_avail_input (expected)
6814 6814
6815/* This is the tty way of reading available input. 6815/* This is the tty way of reading available input.
6816 6816
6817 Note that each terminal device has its own `struct device' object, 6817 Note that each terminal device has its own `struct terminal' object,
6818 and so this function is called once for each individual termcap 6818 and so this function is called once for each individual termcap
6819 display. The first parameter indicates which device to read from. */ 6819 terminal. The first parameter indicates which terminal to read from. */
6820 6820
6821int 6821int
6822tty_read_avail_input (struct device *device, 6822tty_read_avail_input (struct terminal *terminal,
6823 int expected, 6823 int expected,
6824 struct input_event *hold_quit) 6824 struct input_event *hold_quit)
6825{ 6825{
@@ -6828,10 +6828,10 @@ tty_read_avail_input (struct device *device,
6828 of characters on some systems when input is stuffed at us. */ 6828 of characters on some systems when input is stuffed at us. */
6829 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; 6829 unsigned char cbuf[KBD_BUFFER_SIZE - 1];
6830 int n_to_read, i; 6830 int n_to_read, i;
6831 struct tty_display_info *tty = device->display_info.tty; 6831 struct tty_display_info *tty = terminal->display_info.tty;
6832 int nread = 0; 6832 int nread = 0;
6833 6833
6834 if (device->type != output_termcap) 6834 if (terminal->type != output_termcap)
6835 abort (); 6835 abort ();
6836 6836
6837 /* XXX I think the following code should be moved to separate hook 6837 /* XXX I think the following code should be moved to separate hook
@@ -6861,7 +6861,7 @@ tty_read_avail_input (struct device *device,
6861 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0) 6861 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
6862 { 6862 {
6863 if (! noninteractive) 6863 if (! noninteractive)
6864 return -2; /* Close this device. */ 6864 return -2; /* Close this terminal. */
6865 else 6865 else
6866 n_to_read = 0; 6866 n_to_read = 0;
6867 } 6867 }
@@ -6890,14 +6890,14 @@ tty_read_avail_input (struct device *device,
6890 when the control tty is taken away. 6890 when the control tty is taken away.
6891 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ 6891 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */
6892 if (nread == -1 && errno == EIO) 6892 if (nread == -1 && errno == EIO)
6893 return -2; /* Close this device. */ 6893 return -2; /* Close this terminal. */
6894#if defined (AIX) && (! defined (aix386) && defined (_BSD)) 6894#if defined (AIX) && (! defined (aix386) && defined (_BSD))
6895 /* The kernel sometimes fails to deliver SIGHUP for ptys. 6895 /* The kernel sometimes fails to deliver SIGHUP for ptys.
6896 This looks incorrect, but it isn't, because _BSD causes 6896 This looks incorrect, but it isn't, because _BSD causes
6897 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, 6897 O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
6898 and that causes a value other than 0 when there is no input. */ 6898 and that causes a value other than 0 when there is no input. */
6899 if (nread == 0) 6899 if (nread == 0)
6900 return -2; /* Close this device. */ 6900 return -2; /* Close this terminal. */
6901#endif 6901#endif
6902 } 6902 }
6903 while ( 6903 while (
@@ -10440,7 +10440,7 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
10440{ 10440{
10441 /* Must preserve main program's value of errno. */ 10441 /* Must preserve main program's value of errno. */
10442 int old_errno = errno; 10442 int old_errno = errno;
10443 struct device *device; 10443 struct terminal *terminal;
10444 10444
10445#if defined (USG) && !defined (POSIX_SIGNALS) 10445#if defined (USG) && !defined (POSIX_SIGNALS)
10446 /* USG systems forget handlers when they are used; 10446 /* USG systems forget handlers when they are used;
@@ -10451,9 +10451,9 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
10451 10451
10452 SIGNAL_THREAD_CHECK (signalnum); 10452 SIGNAL_THREAD_CHECK (signalnum);
10453 10453
10454 /* See if we have an active display on our controlling terminal. */ 10454 /* See if we have an active terminal on our controlling tty. */
10455 device = get_named_tty (NULL); 10455 terminal = get_named_tty (NULL);
10456 if (!device) 10456 if (!terminal)
10457 { 10457 {
10458 /* If there are no frames there, let's pretend that we are a 10458 /* If there are no frames there, let's pretend that we are a
10459 well-behaving UN*X program and quit. */ 10459 well-behaving UN*X program and quit. */
@@ -10467,7 +10467,7 @@ interrupt_signal (signalnum) /* If we don't have an argument, */
10467 controlling tty, if we have a frame there. We disable the 10467 controlling tty, if we have a frame there. We disable the
10468 interrupt key on secondary ttys, so the SIGINT must have come 10468 interrupt key on secondary ttys, so the SIGINT must have come
10469 from the controlling tty. */ 10469 from the controlling tty. */
10470 internal_last_event_frame = device->display_info.tty->top_frame; 10470 internal_last_event_frame = terminal->display_info.tty->top_frame;
10471 10471
10472 handle_interrupt (); 10472 handle_interrupt ();
10473 } 10473 }
@@ -10710,18 +10710,18 @@ DEFUN ("set-output-flow-control", Fset_output_flow_control, Sset_output_flow_con
10710If FLOW is non-nil, flow control is enabled and you cannot use C-s or 10710If FLOW is non-nil, flow control is enabled and you cannot use C-s or
10711C-q in key sequences. 10711C-q in key sequences.
10712 10712
10713This setting only has an effect on tty display devices and only when 10713This setting only has an effect on tty terminals and only when
10714Emacs reads input in CBREAK mode; see `set-input-interrupt-mode'. 10714Emacs reads input in CBREAK mode; see `set-input-interrupt-mode'.
10715 10715
10716See also `current-input-mode'. */) 10716See also `current-input-mode'. */)
10717 (flow, terminal) 10717 (flow, terminal)
10718 Lisp_Object flow, terminal; 10718 Lisp_Object flow, terminal;
10719{ 10719{
10720 struct device *d = get_device (terminal, 1); 10720 struct terminal *t = get_terminal (terminal, 1);
10721 struct tty_display_info *tty; 10721 struct tty_display_info *tty;
10722 if (d == NULL || d->type != output_termcap) 10722 if (t == NULL || t->type != output_termcap)
10723 return Qnil; 10723 return Qnil;
10724 tty = d->display_info.tty; 10724 tty = t->display_info.tty;
10725 10725
10726 if (tty->flow_control != !NILP (flow)) 10726 if (tty->flow_control != !NILP (flow))
10727 { 10727 {
@@ -10750,9 +10750,9 @@ parity.
10750Otherwise, Emacs will accept and pass through 8-bit input without 10750Otherwise, Emacs will accept and pass through 8-bit input without
10751specially interpreting the top bit. 10751specially interpreting the top bit.
10752 10752
10753This setting only has an effect on tty display devices. 10753This setting only has an effect on tty terminal devices.
10754 10754
10755Optional parameter TERMINAL specifies the tty display device to use. 10755Optional parameter TERMINAL specifies the tty terminal device to use.
10756It may be a terminal id, a frame, or nil for the terminal used by the 10756It may be a terminal id, a frame, or nil for the terminal used by the
10757currently selected frame. 10757currently selected frame.
10758 10758
@@ -10760,13 +10760,13 @@ See also `current-input-mode'. */)
10760 (meta, terminal) 10760 (meta, terminal)
10761 Lisp_Object meta, terminal; 10761 Lisp_Object meta, terminal;
10762{ 10762{
10763 struct device *d = get_device (terminal, 1); 10763 struct terminal *t = get_terminal (terminal, 1);
10764 struct tty_display_info *tty; 10764 struct tty_display_info *tty;
10765 int new_meta; 10765 int new_meta;
10766 10766
10767 if (d == NULL || d->type != output_termcap) 10767 if (t == NULL || t->type != output_termcap)
10768 return Qnil; 10768 return Qnil;
10769 tty = d->display_info.tty; 10769 tty = t->display_info.tty;
10770 10770
10771 if (NILP (meta)) 10771 if (NILP (meta))
10772 new_meta = 0; 10772 new_meta = 0;
@@ -10795,18 +10795,18 @@ DEFUN ("set-quit-char", Fset_quit_char, Sset_quit_char, 1, 1, 0,
10795 doc: /* Specify character used for quitting. 10795 doc: /* Specify character used for quitting.
10796QUIT must be an ASCII character. 10796QUIT must be an ASCII character.
10797 10797
10798This function only has an effect on the tty display on the controlling 10798This function only has an effect on the terminal on the controlling
10799tty of the Emacs process. 10799tty of the Emacs process.
10800 10800
10801See also `current-input-mode'. */) 10801See also `current-input-mode'. */)
10802 (quit) 10802 (quit)
10803 Lisp_Object quit; 10803 Lisp_Object quit;
10804{ 10804{
10805 struct device *d = get_named_tty (NULL); 10805 struct terminal *t = get_named_tty (NULL);
10806 struct tty_display_info *tty; 10806 struct tty_display_info *tty;
10807 if (d == NULL || d->type != output_termcap) 10807 if (t == NULL || t->type != output_termcap)
10808 return Qnil; 10808 return Qnil;
10809 tty = d->display_info.tty; 10809 tty = t->display_info.tty;
10810 10810
10811#ifndef DOS_NT 10811#ifndef DOS_NT
10812 /* this causes startup screen to be restored and messes with the mouse */ 10812 /* this causes startup screen to be restored and messes with the mouse */
@@ -11025,7 +11025,7 @@ delete_kboard (kb)
11025 && FRAMEP (selected_frame) 11025 && FRAMEP (selected_frame)
11026 && FRAME_LIVE_P (XFRAME (selected_frame))) 11026 && FRAME_LIVE_P (XFRAME (selected_frame)))
11027 { 11027 {
11028 current_kboard = XFRAME (selected_frame)->device->kboard; 11028 current_kboard = XFRAME (selected_frame)->terminal->kboard;
11029 if (current_kboard == kb) 11029 if (current_kboard == kb)
11030 abort (); 11030 abort ();
11031 } 11031 }
@@ -11463,7 +11463,7 @@ command exit.
11463The value `kill-region' is special; it means that the previous command 11463The value `kill-region' is special; it means that the previous command
11464was a kill command. 11464was a kill command.
11465 11465
11466`last-command' has a separate binding for each display device. 11466`last-command' has a separate binding for each terminal device.
11467See Info node `(elisp)Multiple displays'. */); 11467See Info node `(elisp)Multiple displays'. */);
11468 11468
11469 DEFVAR_KBOARD ("real-last-command", Vreal_last_command, 11469 DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
@@ -11589,8 +11589,8 @@ untranslated. In a vector, an element which is nil means "no translation".
11589This is applied to the characters supplied to input methods, not their 11589This is applied to the characters supplied to input methods, not their
11590output. See also `translation-table-for-input'. 11590output. See also `translation-table-for-input'.
11591 11591
11592`local-keyboard-translate-table' has a separate binding for each 11592This variable has a separate binding for each terminal. See Info node
11593terminal. See Info node `(elisp)Multiple displays'. */); 11593`(elisp)Multiple displays'. */);
11594 11594
11595 DEFVAR_BOOL ("cannot-suspend", &cannot_suspend, 11595 DEFVAR_BOOL ("cannot-suspend", &cannot_suspend,
11596 doc: /* Non-nil means to always spawn a subshell instead of suspending. 11596 doc: /* Non-nil means to always spawn a subshell instead of suspending.
@@ -11677,7 +11677,8 @@ It also replaces `overriding-local-map'.
11677This variable is intended to let commands such as `universal-argument' 11677This variable is intended to let commands such as `universal-argument'
11678set up a different keymap for reading the next command. 11678set up a different keymap for reading the next command.
11679 11679
11680`overriding-terminal-local-map' has a separate binding for each display device. 11680`overriding-terminal-local-map' has a separate binding for each
11681terminal device.
11681See Info node `(elisp)Multiple displays'. */); 11682See Info node `(elisp)Multiple displays'. */);
11682 11683
11683 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map, 11684 DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map,
@@ -11705,7 +11706,7 @@ Each element should have the form (N . SYMBOL) where N is the
11705numeric keysym code (sans the \"system-specific\" bit 1<<28) 11706numeric keysym code (sans the \"system-specific\" bit 1<<28)
11706and SYMBOL is its name. 11707and SYMBOL is its name.
11707 11708
11708`system-key-alist' has a separate binding for each display device. 11709`system-key-alist' has a separate binding for each terminal device.
11709See Info node `(elisp)Multiple displays'. */); 11710See Info node `(elisp)Multiple displays'. */);
11710 11711
11711 DEFVAR_KBOARD ("local-function-key-map", Vlocal_function_key_map, 11712 DEFVAR_KBOARD ("local-function-key-map", Vlocal_function_key_map,
@@ -11731,15 +11732,15 @@ Typing `ESC O P' to `read-key-sequence' would return [f1]. Typing
11731`C-x ESC O P' would return [?\\C-x f1]. If [f1] were a prefix key, 11732`C-x ESC O P' would return [?\\C-x f1]. If [f1] were a prefix key,
11732typing `ESC O P x' would return [f1 x]. 11733typing `ESC O P x' would return [f1 x].
11733 11734
11734`local-function-key-map' has a separate binding for each display 11735`local-function-key-map' has a separate binding for each terminal
11735device. See Info node `(elisp)Multiple displays'. If you need to 11736device. See Info node `(elisp)Multiple displays'. If you need to
11736define a binding on all display devices, change `function-key-map' 11737define a binding on all terminals, change `function-key-map'
11737instead. Initially, `local-function-key-map' is an empty keymap that 11738instead. Initially, `local-function-key-map' is an empty keymap that
11738has `function-key-map' as its parent on all display devices. */); 11739has `function-key-map' as its parent on all terminal devices. */);
11739 11740
11740 DEFVAR_LISP ("function-key-map", &Vfunction_key_map, 11741 DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
11741 doc: /* The parent keymap of all `local-function-key-map' instances. 11742 doc: /* The parent keymap of all `local-function-key-map' instances.
11742Function key definitions that apply to all display devices should go 11743Function key definitions that apply to all terminal devices should go
11743here. If a mapping is defined in both the current 11744here. If a mapping is defined in both the current
11744`local-function-key-map' binding and this variable, then the local 11745`local-function-key-map' binding and this variable, then the local
11745definition will take precendence. */); 11746definition will take precendence. */);
@@ -11750,13 +11751,13 @@ definition will take precendence. */);
11750This keymap works like `function-key-map', but comes after that, 11751This keymap works like `function-key-map', but comes after that,
11751and its non-prefix bindings override ordinary bindings. 11752and its non-prefix bindings override ordinary bindings.
11752 11753
11753`key-translation-map' has a separate binding for each display device. 11754`key-translation-map' has a separate binding for each terminal device.
11754(See Info node `(elisp)Multiple displays'.) If you need to set a key 11755(See Info node `(elisp)Multiple displays'.) If you need to set a key
11755translation on all devices, change `global-key-translation-map' instead. */); 11756translation on all terminals, change `global-key-translation-map' instead. */);
11756 11757
11757 DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, 11758 DEFVAR_LISP ("key-translation-map", &Vkey_translation_map,
11758 doc: /* The parent keymap of all `local-key-translation-map' instances. 11759 doc: /* The parent keymap of all `local-key-translation-map' instances.
11759Key translations that apply to all display devices should go here. */); 11760Key translations that apply to all terminal devices should go here. */);
11760 Vkey_translation_map = Fmake_sparse_keymap (Qnil); 11761 Vkey_translation_map = Fmake_sparse_keymap (Qnil);
11761 11762
11762 DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list, 11763 DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list,