comparison src/keyboard.c @ 4471:31c5586e9d36

(Fset_input_mode): Start polling, if appropriate. At the beginning, stop polling. Remove period from error message. (stop_polling, start_polling): Check for interrupt_input. (POLL_FOR_INPUT): Define whether or not target supports SIGIO.
author Richard M. Stallman <rms@gnu.org>
date Fri, 06 Aug 1993 21:17:16 +0000
parents 02b7d9476fae
children e9389ba6e04c
comparison
equal deleted inserted replaced
4470:6dd518d1f5aa 4471:31c5586e9d36
428 #ifdef SIGIO 428 #ifdef SIGIO
429 #undef SIGIO 429 #undef SIGIO
430 #endif 430 #endif
431 #endif 431 #endif
432 432
433 /* If we support X Windows, and won't get an interrupt when input 433 /* If we support X Windows, turn on the code to poll periodically
434 arrives from the server, poll periodically so we can detect C-g. */ 434 to detect C-g. It isn't actually used when doing interrupt input. */
435 #ifdef HAVE_X_WINDOWS 435 #ifdef HAVE_X_WINDOWS
436 #ifndef SIGIO
437 #define POLL_FOR_INPUT 436 #define POLL_FOR_INPUT
438 #endif
439 #endif 437 #endif
440 438
441 /* Global variable declarations. */ 439 /* Global variable declarations. */
442 440
443 /* Function for init_keyboard to call with no args (if nonzero). */ 441 /* Function for init_keyboard to call with no args (if nonzero). */
1229 This function is called unconditionally from various places. */ 1227 This function is called unconditionally from various places. */
1230 1228
1231 start_polling () 1229 start_polling ()
1232 { 1230 {
1233 #ifdef POLL_FOR_INPUT 1231 #ifdef POLL_FOR_INPUT
1234 if (read_socket_hook) 1232 if (read_socket_hook && !interrupt_input)
1235 { 1233 {
1236 poll_suppress_count--; 1234 poll_suppress_count--;
1237 if (poll_suppress_count == 0) 1235 if (poll_suppress_count == 0)
1238 { 1236 {
1239 signal (SIGALRM, input_poll_signal); 1237 signal (SIGALRM, input_poll_signal);
1247 /* Turn off polling. */ 1245 /* Turn off polling. */
1248 1246
1249 stop_polling () 1247 stop_polling ()
1250 { 1248 {
1251 #ifdef POLL_FOR_INPUT 1249 #ifdef POLL_FOR_INPUT
1252 if (read_socket_hook) 1250 if (read_socket_hook && !interrupt_input)
1253 { 1251 {
1254 if (poll_suppress_count == 0) 1252 if (poll_suppress_count == 0)
1255 { 1253 {
1256 polling_for_input = 0; 1254 polling_for_input = 0;
1257 alarm (0); 1255 alarm (0);
4930 Lisp_Object interrupt, flow, meta, quit; 4928 Lisp_Object interrupt, flow, meta, quit;
4931 { 4929 {
4932 if (!NILP (quit) 4930 if (!NILP (quit)
4933 && (XTYPE (quit) != Lisp_Int 4931 && (XTYPE (quit) != Lisp_Int
4934 || XINT (quit) < 0 || XINT (quit) > 0400)) 4932 || XINT (quit) < 0 || XINT (quit) > 0400))
4935 error ("set-input-mode: QUIT must be an ASCII character."); 4933 error ("set-input-mode: QUIT must be an ASCII character");
4934
4935 #ifdef POLL_FOR_INPUT
4936 stop_polling ();
4937 #endif
4936 4938
4937 reset_sys_modes (); 4939 reset_sys_modes ();
4938 #ifdef SIGIO 4940 #ifdef SIGIO
4939 /* Note SIGIO has been undef'd if FIONREAD is missing. */ 4941 /* Note SIGIO has been undef'd if FIONREAD is missing. */
4940 #ifdef NO_SOCK_SIGIO 4942 #ifdef NO_SOCK_SIGIO
4960 if (!NILP (quit)) 4962 if (!NILP (quit))
4961 /* Don't let this value be out of range. */ 4963 /* Don't let this value be out of range. */
4962 quit_char = XINT (quit) & (meta_key ? 0377 : 0177); 4964 quit_char = XINT (quit) & (meta_key ? 0377 : 0177);
4963 4965
4964 init_sys_modes (); 4966 init_sys_modes ();
4967
4968 #ifdef POLL_FOR_INPUT
4969 poll_suppress_count = 1;
4970 start_polling ();
4971 #endif
4965 return Qnil; 4972 return Qnil;
4966 } 4973 }
4967 4974
4968 DEFUN ("current-input-mode", Fcurrent_input_mode, Scurrent_input_mode, 0, 0, 0, 4975 DEFUN ("current-input-mode", Fcurrent_input_mode, Scurrent_input_mode, 0, 0, 0,
4969 "Return information about the way Emacs currently reads keyboard input.\n\ 4976 "Return information about the way Emacs currently reads keyboard input.\n\