Mercurial > emacs
comparison src/keyboard.c @ 83047:55d4fe5962fd
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-104
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-105
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-106
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-87
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 20 Feb 2004 15:41:31 +0000 |
parents | 30ccd595ccb0 5a946bc3433a |
children | b8aef5cd0bf2 |
comparison
equal
deleted
inserted
replaced
83046:8ba4eb224be7 | 83047:55d4fe5962fd |
---|---|
4049 *kbp = current_kboard; | 4049 *kbp = current_kboard; |
4050 /* Note that this uses F to determine which display to look at. | 4050 /* Note that this uses F to determine which display to look at. |
4051 If there is no valid info, it does not store anything | 4051 If there is no valid info, it does not store anything |
4052 so x remains nil. */ | 4052 so x remains nil. */ |
4053 x = Qnil; | 4053 x = Qnil; |
4054 | 4054 |
4055 /* XXX Can f or mouse_position_hook be NULL here? */ | 4055 /* XXX Can f or mouse_position_hook be NULL here? */ |
4056 if (f && FRAME_DISPLAY (f)->mouse_position_hook) | 4056 if (f && FRAME_DISPLAY (f)->mouse_position_hook) |
4057 (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, 0, &bar_window, | 4057 (*FRAME_DISPLAY (f)->mouse_position_hook) (&f, 0, &bar_window, |
4058 &part, &x, &y, &time); | 4058 &part, &x, &y, &time); |
4059 | 4059 |
4060 obj = Qnil; | 4060 obj = Qnil; |
4061 | 4061 |
4984 } | 4984 } |
4985 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) | 4985 else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) |
4986 { | 4986 { |
4987 Lisp_Object string; | 4987 Lisp_Object string; |
4988 int charpos; | 4988 int charpos; |
4989 | 4989 |
4990 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; | 4990 posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; |
4991 rx = wx, ry = wy; | 4991 rx = wx, ry = wy; |
4992 string = marginal_area_string (w, part, &rx, &ry, &charpos, | 4992 string = marginal_area_string (w, part, &rx, &ry, &charpos, |
4993 &object, &dx, &dy, &width, &height); | 4993 &object, &dx, &dy, &width, &height); |
4994 if (STRINGP (string)) | 4994 if (STRINGP (string)) |
5467 | 5467 |
5468 case WHEEL_EVENT: | 5468 case WHEEL_EVENT: |
5469 { | 5469 { |
5470 Lisp_Object position; | 5470 Lisp_Object position; |
5471 Lisp_Object head; | 5471 Lisp_Object head; |
5472 | 5472 |
5473 /* Build the position as appropriate for this mouse click. */ | 5473 /* Build the position as appropriate for this mouse click. */ |
5474 struct frame *f = XFRAME (event->frame_or_window); | 5474 struct frame *f = XFRAME (event->frame_or_window); |
5475 | 5475 |
5476 /* Ignore wheel events that were made on frame that have been | 5476 /* Ignore wheel events that were made on frame that have been |
5477 deleted. */ | 5477 deleted. */ |
6455 || readable_filtered_events (do_timers_now, filter_events)); | 6455 || readable_filtered_events (do_timers_now, filter_events)); |
6456 | 6456 |
6457 /* If input is being read as it arrives, and we have none, there is none. */ | 6457 /* If input is being read as it arrives, and we have none, there is none. */ |
6458 if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) | 6458 if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) |
6459 return; | 6459 return; |
6460 | 6460 |
6461 /* Try to read some input and see how much we get. */ | 6461 /* Try to read some input and see how much we get. */ |
6462 gobble_input (0); | 6462 gobble_input (0); |
6463 *addr = (!NILP (Vquit_flag) | 6463 *addr = (!NILP (Vquit_flag) |
6464 || readable_filtered_events (do_timers_now, filter_events)); | 6464 || readable_filtered_events (do_timers_now, filter_events)); |
6465 } | 6465 } |
6558 } | 6558 } |
6559 } | 6559 } |
6560 | 6560 |
6561 #ifndef VMS | 6561 #ifndef VMS |
6562 | 6562 |
6563 /* We make the read_avail_input buffer static to avoid zeroing out the | |
6564 whole struct input_event buf on every call. */ | |
6565 static struct input_event read_avail_input_buf[KBD_BUFFER_SIZE]; | |
6566 | |
6567 /* I don't know whether it is necessary, but make read_avail_input | |
6568 re-entrant. */ | |
6569 static int in_read_avail_input = 0; | |
6570 | |
6571 /* Read any terminal input already buffered up by the system | 6563 /* Read any terminal input already buffered up by the system |
6572 into the kbd_buffer, but do not wait. | 6564 into the kbd_buffer, but do not wait. |
6573 | 6565 |
6574 EXPECTED should be nonzero if the caller knows there is some input. | 6566 EXPECTED should be nonzero if the caller knows there is some input. |
6575 | 6567 |
6576 Except on VMS, all input is read by this function. | 6568 Except on VMS, all input is read by this function. |
6577 If interrupt_input is nonzero, this function MUST be called | 6569 If interrupt_input is nonzero, this function MUST be called |
6578 only when SIGIO is blocked. | 6570 only when SIGIO is blocked. |
6579 | 6571 |
6580 Returns the number of keyboard chars read, or -1 meaning | 6572 Returns the number of keyboard chars read, or -1 meaning |
6581 this is a bad time to try to read input. */ | 6573 this is a bad time to try to read input. |
6574 | |
6575 Typically, there are just a few available input events to be read | |
6576 here, so we really don't need to allocate and initialize a big | |
6577 buffer of input_events as we used to do. Instead, we just allocate | |
6578 a small buffer of input events -- and then poll for more input if we | |
6579 read a full buffer of input events. */ | |
6580 | |
6581 #define NREAD_INPUT_EVENTS 8 | |
6582 | 6582 |
6583 static int | 6583 static int |
6584 read_avail_input (expected) | 6584 read_avail_input (expected) |
6585 int expected; | 6585 int expected; |
6586 { | 6586 { |
6587 struct input_event *buf = read_avail_input_buf; | |
6588 struct input_event tmp_buf[KBD_BUFFER_SIZE]; | |
6589 register int i; | 6587 register int i; |
6590 int nread = 0; | 6588 int nread = 0; |
6591 struct display *d; | 6589 struct display *d; |
6592 | |
6593 /* Trivial hack to make read_avail_input re-entrant. */ | |
6594 if (in_read_avail_input++) | |
6595 { | |
6596 buf = tmp_buf; | |
6597 for (i = 0; i < KBD_BUFFER_SIZE; i++) | |
6598 EVENT_INIT (buf[i]); | |
6599 } | |
6600 | 6590 |
6601 /* Loop through the available displays, and call their input hooks. */ | 6591 /* Loop through the available displays, and call their input hooks. */ |
6602 d = display_list; | 6592 d = display_list; |
6603 while (d) | 6593 while (d) |
6604 { | 6594 { |
6605 struct display *next = d->next_display; | 6595 struct display *next = d->next_display; |
6606 | 6596 |
6607 if (d->read_socket_hook) | 6597 if (d->read_socket_hook) |
6608 /* No need for FIONREAD or fcntl; just say don't wait. */ | |
6609 nread = (*d->read_socket_hook) (d, buf, KBD_BUFFER_SIZE, expected); | |
6610 | |
6611 if (nread == -2) /* -2 means non-transient error */ | |
6612 { | 6598 { |
6613 /* The display device terminated; it should be closed. */ | 6599 int discard = 0; |
6614 | 6600 int nr; |
6615 /* Kill Emacs if this was our last display. */ | 6601 |
6616 if (! display_list->next_display) | 6602 do { |
6617 kill (getpid (), SIGHUP); | 6603 struct input_event buf[NREAD_INPUT_EVENTS]; |
6618 | 6604 |
6619 /* XXX Is calling delete_display safe here? It calls Fdelete_frame. */ | 6605 for (i = 0; i < NREAD_INPUT_EVENTS; i++) |
6620 if (d->delete_display_hook) | 6606 EVENT_INIT (buf[i]); |
6621 (*d->delete_display_hook) (d); | 6607 |
6622 else | 6608 /* No need for FIONREAD or fcntl; just say don't wait. */ |
6623 delete_display (d); | 6609 nr = (*d->read_socket_hook) (d, buf, NREAD_INPUT_EVENTS, expected); |
6610 | |
6611 if (nr > 0) | |
6612 { | |
6613 /* We've got input. */ | |
6614 nread += nr; | |
6615 expected = 0; | |
6616 | |
6617 /* Scan the chars for C-g and store them in kbd_buffer. */ | |
6618 for (i = 0; !discard && i < nr; i++) | |
6619 { | |
6620 kbd_buffer_store_event (&buf[i]); | |
6621 /* Don't look at input that follows a C-g too closely. | |
6622 This reduces lossage due to autorepeat on C-g. */ | |
6623 if (buf[i].kind == ASCII_KEYSTROKE_EVENT | |
6624 && buf[i].code == quit_char) | |
6625 discard = 1; | |
6626 } | |
6627 } | |
6628 else if (nr == -2) /* Non-transient error. */ | |
6629 { | |
6630 /* The display device terminated; it should be closed. */ | |
6631 | |
6632 /* Kill Emacs if this was our last display. */ | |
6633 if (! display_list->next_display) | |
6634 /* Formerly simply reported no input, but that | |
6635 sometimes led to a failure of Emacs to terminate. | |
6636 SIGHUP seems appropriate if we can't reach the | |
6637 terminal. */ | |
6638 /* ??? Is it really right to send the signal just to | |
6639 this process rather than to the whole process | |
6640 group? Perhaps on systems with FIONREAD Emacs is | |
6641 alone in its group. */ | |
6642 kill (getpid (), SIGHUP); | |
6643 | |
6644 /* XXX Is calling delete_display safe here? It calls Fdelete_frame. */ | |
6645 if (d->delete_display_hook) | |
6646 (*d->delete_display_hook) (d); | |
6647 else | |
6648 delete_display (d); | |
6649 } | |
6650 } while (nr == NREAD_INPUT_EVENTS); | |
6624 } | 6651 } |
6625 else if (nread > 0) | |
6626 { | |
6627 /* We've got input. */ | |
6628 break; | |
6629 } | |
6630 | 6652 |
6631 d = next; | 6653 d = next; |
6632 } | 6654 } |
6633 | |
6634 /* Scan the chars for C-g and store them in kbd_buffer. */ | |
6635 for (i = 0; i < nread; i++) | |
6636 { | |
6637 kbd_buffer_store_event (&buf[i]); | |
6638 /* Don't look at input that follows a C-g too closely. | |
6639 This reduces lossage due to autorepeat on C-g. */ | |
6640 if (buf[i].kind == ASCII_KEYSTROKE_EVENT | |
6641 && buf[i].code == quit_char) | |
6642 break; | |
6643 } | |
6644 | |
6645 /* Clear used events */ | |
6646 if (--in_read_avail_input == 0) | |
6647 for (i = 0; i < nread; i++) | |
6648 EVENT_INIT (buf[i]); | |
6649 | 6655 |
6650 return nread; | 6656 return nread; |
6651 } | 6657 } |
6652 | 6658 |
6653 /* This is the tty way of reading available input. | 6659 /* This is the tty way of reading available input. |
6666 of characters on some systems when input is stuffed at us. */ | 6672 of characters on some systems when input is stuffed at us. */ |
6667 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; | 6673 unsigned char cbuf[KBD_BUFFER_SIZE - 1]; |
6668 int n_to_read, i; | 6674 int n_to_read, i; |
6669 struct tty_display_info *tty = display->display_info.tty; | 6675 struct tty_display_info *tty = display->display_info.tty; |
6670 int nread = 0; | 6676 int nread = 0; |
6671 | 6677 |
6672 if (display->type != output_termcap) | 6678 if (display->type != output_termcap) |
6673 abort (); | 6679 abort (); |
6674 | 6680 |
6675 /* XXX I think the following code should be moved to separate hook | 6681 /* XXX I think the following code should be moved to separate hook |
6676 functions in system-dependent files. */ | 6682 functions in system-dependent files. */ |
6677 #ifdef WINDOWSNT | 6683 #ifdef WINDOWSNT |
6678 return 0; | 6684 return 0; |
6679 #else /* not WINDOWSNT */ | 6685 #else /* not WINDOWSNT */ |
6680 #ifdef MSDOS | 6686 #ifdef MSDOS |
6681 n_to_read = dos_keysns (); | 6687 n_to_read = dos_keysns (); |
6682 if (n_to_read == 0) | 6688 if (n_to_read == 0) |
6683 return 0; | 6689 return 0; |
6684 | 6690 |
6685 cbuf[0] = dos_keyread (); | 6691 cbuf[0] = dos_keyread (); |
6686 nread = 1; | 6692 nread = 1; |
6687 | 6693 |
6688 #else /* not MSDOS */ | 6694 #else /* not MSDOS */ |
6689 | 6695 |
6690 if (! tty->term_initted) /* In case we get called during bootstrap. */ | 6696 if (! tty->term_initted) /* In case we get called during bootstrap. */ |
6691 return 0; | 6697 return 0; |
6692 | 6698 |
6693 /* Determine how many characters we should *try* to read. */ | 6699 /* Determine how many characters we should *try* to read. */ |
6694 #ifdef FIONREAD | 6700 #ifdef FIONREAD |
6695 /* Find out how much input is available. */ | 6701 /* Find out how much input is available. */ |
6696 if (ioctl (fileno (TTY_INPUT (tty)), FIONREAD, &n_to_read) < 0) | 6702 if (ioctl (fileno (TTY_INPUT (tty)), FIONREAD, &n_to_read) < 0) |
6697 { | 6703 { |
6711 fcntl (fileno (TTY_INPUT (tty)), F_SETFL, O_NDELAY); | 6717 fcntl (fileno (TTY_INPUT (tty)), F_SETFL, O_NDELAY); |
6712 #else | 6718 #else |
6713 you lose; | 6719 you lose; |
6714 #endif | 6720 #endif |
6715 #endif | 6721 #endif |
6716 | 6722 |
6717 /* Now read; for one reason or another, this will not block. | 6723 /* Now read; for one reason or another, this will not block. |
6718 NREAD is set to the number of chars read. */ | 6724 NREAD is set to the number of chars read. */ |
6719 do | 6725 do |
6720 { | 6726 { |
6721 nread = emacs_read (fileno (TTY_INPUT (tty)), cbuf, n_to_read); | 6727 nread = emacs_read (fileno (TTY_INPUT (tty)), cbuf, n_to_read); |
6751 ) | 6757 ) |
6752 #else | 6758 #else |
6753 0 | 6759 0 |
6754 #endif | 6760 #endif |
6755 ); | 6761 ); |
6756 | 6762 |
6757 #ifndef FIONREAD | 6763 #ifndef FIONREAD |
6758 #if defined (USG) || defined (DGUX) || defined (CYGWIN) | 6764 #if defined (USG) || defined (DGUX) || defined (CYGWIN) |
6759 fcntl (fileno (TTY_INPUT (tty)), F_SETFL, 0); | 6765 fcntl (fileno (TTY_INPUT (tty)), F_SETFL, 0); |
6760 #endif /* USG or DGUX or CYGWIN */ | 6766 #endif /* USG or DGUX or CYGWIN */ |
6761 #endif /* no FIONREAD */ | 6767 #endif /* no FIONREAD */ |
6762 | 6768 |
6763 if (nread <= 0) | 6769 if (nread <= 0) |
6764 return nread; | 6770 return nread; |
6765 | 6771 |
6766 #endif /* not MSDOS */ | 6772 #endif /* not MSDOS */ |
6767 #endif /* not WINDOWSNT */ | 6773 #endif /* not WINDOWSNT */ |
6768 | 6774 |
6769 for (i = 0; i < nread; i++) | 6775 for (i = 0; i < nread; i++) |
6770 { | 6776 { |
6771 buf[i].kind = ASCII_KEYSTROKE_EVENT; | 6777 buf[i].kind = ASCII_KEYSTROKE_EVENT; |
6772 buf[i].modifiers = 0; | 6778 buf[i].modifiers = 0; |
6773 if (tty->meta_key == 1 && (cbuf[i] & 0x80)) | 6779 if (tty->meta_key == 1 && (cbuf[i] & 0x80)) |
6774 buf[i].modifiers = meta_modifier; | 6780 buf[i].modifiers = meta_modifier; |
6775 if (tty->meta_key != 2) | 6781 if (tty->meta_key != 2) |
6776 cbuf[i] &= ~0x80; | 6782 cbuf[i] &= ~0x80; |
6777 | 6783 |
6778 buf[i].code = cbuf[i]; | 6784 buf[i].code = cbuf[i]; |
6779 /* Set the frame corresponding to the active tty. Note that the | 6785 /* Set the frame corresponding to the active tty. Note that the |
6780 value of selected_frame is not reliable here, redisplay tends | 6786 value of selected_frame is not reliable here, redisplay tends |
6781 to temporarily change it. */ | 6787 to temporarily change it. */ |
6782 buf[i].frame_or_window = tty->top_frame; | 6788 buf[i].frame_or_window = tty->top_frame; |
6783 buf[i].arg = Qnil; | 6789 buf[i].arg = Qnil; |
6784 } | 6790 } |
6785 | 6791 |
6786 return nread; | 6792 return nread; |
6787 } | 6793 } |
6788 | |
6789 #endif /* not VMS */ | 6794 #endif /* not VMS */ |
6790 | 6795 |
6791 void | 6796 void |
6792 handle_async_input () | 6797 handle_async_input () |
6793 { | 6798 { |
8314 access_keymap_keyremap (map, key, prompt, do_funcall) | 8319 access_keymap_keyremap (map, key, prompt, do_funcall) |
8315 Lisp_Object map, key, prompt; | 8320 Lisp_Object map, key, prompt; |
8316 int do_funcall; | 8321 int do_funcall; |
8317 { | 8322 { |
8318 Lisp_Object next; | 8323 Lisp_Object next; |
8319 | 8324 |
8320 next = access_keymap (map, key, 1, 0, 1); | 8325 next = access_keymap (map, key, 1, 0, 1); |
8321 | 8326 |
8322 /* Handle symbol with autoload definition. */ | 8327 /* Handle symbol with autoload definition. */ |
8323 if (SYMBOLP (next) && !NILP (Ffboundp (next)) | 8328 if (SYMBOLP (next) && !NILP (Ffboundp (next)) |
8324 && CONSP (XSYMBOL (next)->function) | 8329 && CONSP (XSYMBOL (next)->function) |
8329 or an array. */ | 8334 or an array. */ |
8330 if (SYMBOLP (next) && !NILP (Ffboundp (next)) | 8335 if (SYMBOLP (next) && !NILP (Ffboundp (next)) |
8331 && (!NILP (Farrayp (XSYMBOL (next)->function)) | 8336 && (!NILP (Farrayp (XSYMBOL (next)->function)) |
8332 || KEYMAPP (XSYMBOL (next)->function))) | 8337 || KEYMAPP (XSYMBOL (next)->function))) |
8333 next = XSYMBOL (next)->function; | 8338 next = XSYMBOL (next)->function; |
8334 | 8339 |
8335 /* If the keymap gives a function, not an | 8340 /* If the keymap gives a function, not an |
8336 array, then call the function with one arg and use | 8341 array, then call the function with one arg and use |
8337 its value instead. */ | 8342 its value instead. */ |
8338 if (SYMBOLP (next) && !NILP (Ffboundp (next)) && do_funcall) | 8343 if (SYMBOLP (next) && !NILP (Ffboundp (next)) && do_funcall) |
8339 { | 8344 { |
9343 { | 9348 { |
9344 mock_input = diff + max (t, mock_input); | 9349 mock_input = diff + max (t, mock_input); |
9345 /* Adjust the function-key-map counters. */ | 9350 /* Adjust the function-key-map counters. */ |
9346 fkey.end += diff; | 9351 fkey.end += diff; |
9347 fkey.start += diff; | 9352 fkey.start += diff; |
9348 | 9353 |
9349 goto replay_sequence; | 9354 goto replay_sequence; |
9350 } | 9355 } |
9351 } | 9356 } |
9352 | 9357 |
9353 /* If KEY is not defined in any of the keymaps, | 9358 /* If KEY is not defined in any of the keymaps, |
10144 int width, height; | 10149 int width, height; |
10145 struct gcpro gcpro1; | 10150 struct gcpro gcpro1; |
10146 | 10151 |
10147 if (tty_list && tty_list->next) | 10152 if (tty_list && tty_list->next) |
10148 error ("Suspend is not supported with multiple ttys"); | 10153 error ("Suspend is not supported with multiple ttys"); |
10149 | 10154 |
10150 if (!NILP (stuffstring)) | 10155 if (!NILP (stuffstring)) |
10151 CHECK_STRING (stuffstring); | 10156 CHECK_STRING (stuffstring); |
10152 | 10157 |
10153 /* Run the functions in suspend-hook. */ | 10158 /* Run the functions in suspend-hook. */ |
10154 if (!NILP (Vrun_hooks)) | 10159 if (!NILP (Vrun_hooks)) |
10278 Fkill_emacs (Qnil); | 10283 Fkill_emacs (Qnil); |
10279 } | 10284 } |
10280 else | 10285 else |
10281 { | 10286 { |
10282 /* Otherwise, the SIGINT was probably generated by C-g. */ | 10287 /* Otherwise, the SIGINT was probably generated by C-g. */ |
10283 | 10288 |
10284 /* Set internal_last_event_frame to the top frame of the | 10289 /* Set internal_last_event_frame to the top frame of the |
10285 controlling tty, if we have a frame there. We disable the | 10290 controlling tty, if we have a frame there. We disable the |
10286 interrupt key on secondary ttys, so the SIGINT must have come | 10291 interrupt key on secondary ttys, so the SIGINT must have come |
10287 from the controlling tty. */ | 10292 from the controlling tty. */ |
10288 internal_last_event_frame = display->display_info.tty->top_frame; | 10293 internal_last_event_frame = display->display_info.tty->top_frame; |
10292 | 10297 |
10293 errno = old_errno; | 10298 errno = old_errno; |
10294 } | 10299 } |
10295 | 10300 |
10296 /* This routine is called at interrupt level in response to C-g. | 10301 /* This routine is called at interrupt level in response to C-g. |
10297 | 10302 |
10298 It is called from the SIGINT handler or kbd_buffer_store_event. | 10303 It is called from the SIGINT handler or kbd_buffer_store_event. |
10299 | 10304 |
10300 If `waiting_for_input' is non zero, then unless `echoing' is | 10305 If `waiting_for_input' is non zero, then unless `echoing' is |
10301 nonzero, immediately throw back to read_char. | 10306 nonzero, immediately throw back to read_char. |
10302 | 10307 |
10305 non-nil, it stops the job right away. */ | 10310 non-nil, it stops the job right away. */ |
10306 | 10311 |
10307 static void | 10312 static void |
10308 handle_interrupt () | 10313 handle_interrupt () |
10309 { | 10314 { |
10310 char c; | 10315 char c; |
10311 struct frame *sf = SELECTED_FRAME (); | 10316 struct frame *sf = SELECTED_FRAME (); |
10312 | 10317 |
10313 cancel_echoing (); | 10318 cancel_echoing (); |
10314 | 10319 |
10315 /* XXX This code needs to be revised for multi-tty support. */ | 10320 /* XXX This code needs to be revised for multi-tty support. */ |
10478 { | 10483 { |
10479 /* XXX This function needs to be revised for multi-device support. | 10484 /* XXX This function needs to be revised for multi-device support. |
10480 Currently it compiles fine, but its semantics are wrong. It sets | 10485 Currently it compiles fine, but its semantics are wrong. It sets |
10481 global parameters (e.g. interrupt_input) based on only the | 10486 global parameters (e.g. interrupt_input) based on only the |
10482 current frame's device. */ | 10487 current frame's device. */ |
10483 | 10488 |
10484 if (!NILP (quit) | 10489 if (!NILP (quit) |
10485 && (!INTEGERP (quit) || XINT (quit) < 0 || XINT (quit) > 0400)) | 10490 && (!INTEGERP (quit) || XINT (quit) < 0 || XINT (quit) > 0400)) |
10486 error ("set-input-mode: QUIT must be an ASCII character"); | 10491 error ("set-input-mode: QUIT must be an ASCII character"); |
10487 | 10492 |
10488 #ifdef POLL_FOR_INPUT | 10493 #ifdef POLL_FOR_INPUT |
10526 else if (EQ (meta, Qt)) | 10531 else if (EQ (meta, Qt)) |
10527 tty->meta_key = 1; | 10532 tty->meta_key = 1; |
10528 else | 10533 else |
10529 tty->meta_key = 2; | 10534 tty->meta_key = 2; |
10530 } | 10535 } |
10531 | 10536 |
10532 if (!NILP (quit)) | 10537 if (!NILP (quit)) |
10533 /* Don't let this value be out of range. */ | 10538 /* Don't let this value be out of range. */ |
10534 quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377); | 10539 quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377); |
10535 | 10540 |
10536 #ifndef DOS_NT | 10541 #ifndef DOS_NT |
10560 `set-input-mode'. */) | 10565 `set-input-mode'. */) |
10561 () | 10566 () |
10562 { | 10567 { |
10563 Lisp_Object val[4]; | 10568 Lisp_Object val[4]; |
10564 struct frame *sf = XFRAME (selected_frame); | 10569 struct frame *sf = XFRAME (selected_frame); |
10565 | 10570 |
10566 val[0] = interrupt_input ? Qt : Qnil; | 10571 val[0] = interrupt_input ? Qt : Qnil; |
10567 if (FRAME_TERMCAP_P (sf)) | 10572 if (FRAME_TERMCAP_P (sf)) |
10568 { | 10573 { |
10569 val[1] = FRAME_TTY (sf)->flow_control ? Qt : Qnil; | 10574 val[1] = FRAME_TTY (sf)->flow_control ? Qt : Qnil; |
10570 val[2] = (FRAME_TTY (sf)->meta_key == 2 | 10575 val[2] = (FRAME_TTY (sf)->meta_key == 2 |
10669 kbd_store_ptr = kbd_buffer; | 10674 kbd_store_ptr = kbd_buffer; |
10670 #ifdef HAVE_MOUSE | 10675 #ifdef HAVE_MOUSE |
10671 do_mouse_tracking = Qnil; | 10676 do_mouse_tracking = Qnil; |
10672 #endif | 10677 #endif |
10673 input_pending = 0; | 10678 input_pending = 0; |
10674 #ifndef VMS | |
10675 { | |
10676 int i; | |
10677 for (i = 0; i < KBD_BUFFER_SIZE; i++) | |
10678 EVENT_INIT (read_avail_input_buf[i]); | |
10679 } | |
10680 #endif | |
10681 | 10679 |
10682 /* This means that command_loop_1 won't try to select anything the first | 10680 /* This means that command_loop_1 won't try to select anything the first |
10683 time through. */ | 10681 time through. */ |
10684 internal_last_event_frame = Qnil; | 10682 internal_last_event_frame = Qnil; |
10685 Vlast_event_frame = internal_last_event_frame; | 10683 Vlast_event_frame = internal_last_event_frame; |
11421 initial_define_lispy_key (Vspecial_event_map, "make-frame-visible", | 11419 initial_define_lispy_key (Vspecial_event_map, "make-frame-visible", |
11422 "ignore-event"); | 11420 "ignore-event"); |
11423 /* Handling it at such a low-level causes read_key_sequence to get | 11421 /* Handling it at such a low-level causes read_key_sequence to get |
11424 * confused because it doesn't realize that the current_buffer was | 11422 * confused because it doesn't realize that the current_buffer was |
11425 * changed by read_char. | 11423 * changed by read_char. |
11426 * | 11424 * |
11427 * initial_define_lispy_key (Vspecial_event_map, "select-window", | 11425 * initial_define_lispy_key (Vspecial_event_map, "select-window", |
11428 * "handle-select-window"); */ | 11426 * "handle-select-window"); */ |
11429 initial_define_lispy_key (Vspecial_event_map, "save-session", | 11427 initial_define_lispy_key (Vspecial_event_map, "save-session", |
11430 "handle-save-session"); | 11428 "handle-save-session"); |
11431 } | 11429 } |