aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 810cf682b18..f1e19079733 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -461,11 +461,6 @@ FILE *dribble;
461/* Nonzero if input is available. */ 461/* Nonzero if input is available. */
462int input_pending; 462int input_pending;
463 463
464/* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
465 keep 0200 bit in input chars. 0 to ignore the 0200 bit. */
466
467int meta_key;
468
469/* Non-zero means force key bindings update in parse_menu_item. */ 464/* Non-zero means force key bindings update in parse_menu_item. */
470 465
471int update_menu_bindings; 466int update_menu_bindings;
@@ -6593,7 +6588,9 @@ read_avail_input (expected)
6593 of characters on some systems when input is stuffed at us. */ 6588 of characters on some systems when input is stuffed at us. */
6594 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; 6589 unsigned char cbuf[KBD_BUFFER_SIZE - 1];
6595 int n_to_read; 6590 int n_to_read;
6596 6591 struct tty_output *tty;
6592 Lisp_Object frame;
6593
6597#ifdef WINDOWSNT 6594#ifdef WINDOWSNT
6598 return 0; 6595 return 0;
6599#else /* not WINDOWSNT */ 6596#else /* not WINDOWSNT */
@@ -6607,12 +6604,14 @@ read_avail_input (expected)
6607 6604
6608#else /* not MSDOS */ 6605#else /* not MSDOS */
6609 6606
6610 struct tty_output *tty;
6611 nread = 0; 6607 nread = 0;
6612 6608
6613 /* Try to read from each available tty, until one succeeds. */ 6609 /* Try to read from each available tty, until one succeeds. */
6614 for (tty = tty_list; tty; tty = tty->next) { 6610 for (tty = tty_list; tty; tty = tty->next) {
6615 6611
6612 if (! tty->term_initted)
6613 continue;
6614
6616 /* Determine how many characters we should *try* to read. */ 6615 /* Determine how many characters we should *try* to read. */
6617#ifdef FIONREAD 6616#ifdef FIONREAD
6618 /* Find out how much input is available. */ 6617 /* Find out how much input is available. */
@@ -6720,15 +6719,15 @@ read_avail_input (expected)
6720 /* Select frame corresponding to the active tty. Note that the 6719 /* Select frame corresponding to the active tty. Note that the
6721 value of selected_frame is not reliable here, redisplay tends 6720 value of selected_frame is not reliable here, redisplay tends
6722 to temporarily change it. But tty should always be non-NULL. */ 6721 to temporarily change it. But tty should always be non-NULL. */
6723 Lisp_Object frame = (tty ? tty->top_frame : selected_frame); 6722 frame = (tty ? tty->top_frame : selected_frame);
6724 6723
6725 for (i = 0; i < nread; i++) 6724 for (i = 0; i < nread; i++)
6726 { 6725 {
6727 buf[i].kind = ASCII_KEYSTROKE_EVENT; 6726 buf[i].kind = ASCII_KEYSTROKE_EVENT;
6728 buf[i].modifiers = 0; 6727 buf[i].modifiers = 0;
6729 if (meta_key == 1 && (cbuf[i] & 0x80)) 6728 if (tty->meta_key == 1 && (cbuf[i] & 0x80))
6730 buf[i].modifiers = meta_modifier; 6729 buf[i].modifiers = meta_modifier;
6731 if (meta_key != 2) 6730 if (tty->meta_key != 2)
6732 cbuf[i] &= ~0x80; 6731 cbuf[i] &= ~0x80;
6733 6732
6734 buf[i].code = cbuf[i]; 6733 buf[i].code = cbuf[i];
@@ -10109,7 +10108,7 @@ On such systems, Emacs starts a subshell instead of suspending. */)
10109 /* sys_suspend can get an error if it tries to fork a subshell 10108 /* sys_suspend can get an error if it tries to fork a subshell
10110 and the system resources aren't available for that. */ 10109 and the system resources aren't available for that. */
10111 record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_sys_modes, 10110 record_unwind_protect ((Lisp_Object (*) P_ ((Lisp_Object))) init_sys_modes,
10112 Qnil); 10111 (Lisp_Object)CURTTY()); /* XXX */
10113 stuff_buffered_input (stuffstring); 10112 stuff_buffered_input (stuffstring);
10114 if (cannot_suspend) 10113 if (cannot_suspend)
10115 sys_subshell (); 10114 sys_subshell ();
@@ -10438,14 +10437,14 @@ See also `current-input-mode'. */)
10438 10437
10439 flow_control = !NILP (flow); 10438 flow_control = !NILP (flow);
10440 if (NILP (meta)) 10439 if (NILP (meta))
10441 meta_key = 0; 10440 FRAME_TTY (SELECTED_FRAME ())->meta_key = 0;
10442 else if (EQ (meta, Qt)) 10441 else if (EQ (meta, Qt))
10443 meta_key = 1; 10442 FRAME_TTY (SELECTED_FRAME ())->meta_key = 1;
10444 else 10443 else
10445 meta_key = 2; 10444 FRAME_TTY (SELECTED_FRAME ())->meta_key = 2;
10446 if (!NILP (quit)) 10445 if (!NILP (quit))
10447 /* Don't let this value be out of range. */ 10446 /* Don't let this value be out of range. */
10448 quit_char = XINT (quit) & (meta_key ? 0377 : 0177); 10447 quit_char = XINT (quit) & (FRAME_TTY (SELECTED_FRAME ())->meta_key ? 0377 : 0177);
10449 10448
10450#ifndef DOS_NT 10449#ifndef DOS_NT
10451 init_all_sys_modes (); 10450 init_all_sys_modes ();
@@ -10478,7 +10477,9 @@ The elements of this list correspond to the arguments of
10478 10477
10479 val[0] = interrupt_input ? Qt : Qnil; 10478 val[0] = interrupt_input ? Qt : Qnil;
10480 val[1] = flow_control ? Qt : Qnil; 10479 val[1] = flow_control ? Qt : Qnil;
10481 val[2] = meta_key == 2 ? make_number (0) : meta_key == 1 ? Qt : Qnil; 10480 val[2] = FRAME_TTY (SELECTED_FRAME ())->meta_key == 2
10481 ? make_number (0)
10482 : FRAME_TTY (SELECTED_FRAME ())->meta_key == 1 ? Qt : Qnil;
10482 XSETFASTINT (val[3], quit_char); 10483 XSETFASTINT (val[3], quit_char);
10483 10484
10484 return Flist (sizeof (val) / sizeof (val[0]), val); 10485 return Flist (sizeof (val) / sizeof (val[0]), val);