comparison src/console.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents ee648375d8d6
children 360340f9fd5f
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
248 select_console_1 (Lisp_Object console) 248 select_console_1 (Lisp_Object console)
249 { 249 {
250 /* perhaps this should do something more complicated */ 250 /* perhaps this should do something more complicated */
251 Vselected_console = console; 251 Vselected_console = console;
252 252
253 /* #### Schedule this to be removed in some future version */ 253 /* #### Schedule this to be removed in 19.14 */
254 #ifdef HAVE_X_WINDOWS 254 #ifdef HAVE_X_WINDOWS
255 if (CONSOLE_X_P (XCONSOLE (console))) 255 if (CONSOLE_X_P (XCONSOLE (console)))
256 Vwindow_system = Qx; 256 Vwindow_system = Qx;
257 else 257 else
258 #endif 258 #endif
271 the user does something to select a different console, or until the next 271 the user does something to select a different console, or until the next
272 time this function is called. 272 time this function is called.
273 */ 273 */
274 (console)) 274 (console))
275 { 275 {
276 Lisp_Object device;
277
278 CHECK_LIVE_CONSOLE (console); 276 CHECK_LIVE_CONSOLE (console);
279 277
280 device = CONSOLE_SELECTED_DEVICE (XCONSOLE (console)); 278 /* select the console's selected frame's selected window. This will call
281 if (!NILP (device)) 279 selected_frame_1(). */
282 { 280 if (!NILP (CONSOLE_SELECTED_DEVICE (XCONSOLE (console))))
283 struct device *d = XDEVICE (device); 281 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (DEVICE_SELECTED_FRAME (XDEVICE (CONSOLE_SELECTED_DEVICE (XCONSOLE (console)))))));
284 Lisp_Object frame = DEVICE_SELECTED_FRAME (d);
285 if (!NILP (frame))
286 {
287 struct frame *f = XFRAME(frame);
288 Fselect_window (FRAME_SELECTED_WINDOW (f));
289 }
290 else
291 error ("Can't select console with no frames.");
292 }
293 else 282 else
294 error ("Can't select a console with no devices"); 283 error ("Can't select a console with no devices");
295 return Qnil; 284 return Qnil;
296 } 285 }
297 286
324 313
325 DEFUN ("console-type", Fconsole_type, 0, 1, 0, /* 314 DEFUN ("console-type", Fconsole_type, 0, 1, 0, /*
326 Return the type of the specified console (e.g. `x' or `tty'). 315 Return the type of the specified console (e.g. `x' or `tty').
327 Value is `tty' for a tty console (a character-only terminal), 316 Value is `tty' for a tty console (a character-only terminal),
328 `x' for a console that is an X display, 317 `x' for a console that is an X display,
329 `ns' for a console that is a NeXTstep connection (not yet implemented), 318 `ns' for a console that is a NeXTstep connection (not yet implemeted),
330 `win32' for a console that is a Windows or Windows NT connection (not yet 319 `win32' for a console that is a Windows or Windows NT connection (not yet
331 implemented), 320 implemented),
332 `pc' for a console that is a direct-write MS-DOS connection (not yet 321 `pc' for a console that is a direct-write MS-DOS connection (not yet
333 implemented), 322 implemented),
334 `stream' for a stream console (which acts like a stdio stream), and 323 `stream' for a stream console (which acts like a stdio stream), and
912 stuff_char (XCONSOLE (Vcontrolling_terminal), *kbd_fetch_ptr++); 901 stuff_char (XCONSOLE (Vcontrolling_terminal), *kbd_fetch_ptr++);
913 } 902 }
914 # endif 903 # endif
915 #endif /* BSD */ 904 #endif /* BSD */
916 } 905 }
917 #ifdef HAVE_TTY
918 extern Lisp_Object Fconsole_tty_controlling_process(Lisp_Object console);
919 #endif
920
921 DEFUN ("suspend-console", Fsuspend_console, 0, 1, "", /*
922 Suspend a console. For tty consoles, it sends a signal to suspend
923 the process in charge of the tty, and removes the devices and
924 frames of that console from the display.
925
926 If optional arg CONSOLE is non-nil, it is the console to be suspended.
927 Otherwise it is assumed to be the selected console.
928
929 Some operating systems cannot stop processes and resume them later.
930 On such systems, who knows what will happen.
931 */
932 (console))
933 {
934 Lisp_Object devcons;
935 Lisp_Object framecons;
936 struct console *c;
937 struct gcpro gcpro1;
938
939 #ifdef HAVE_TTY
940 if (NILP (console))
941 console=Fselected_console();
942
943 GCPRO1 (console);
944
945 c = decode_console(console);
946
947 if (CONSOLE_TTY_P (c))
948 {
949 CONSOLE_DEVICE_LOOP (devcons, c)
950 {
951 struct device *d = XDEVICE (XCAR (devcons));
952 DEVICE_FRAME_LOOP (framecons, d)
953 {
954 Fmake_frame_invisible(XCAR(framecons), Qt);
955 }
956 }
957 reset_one_console(c);
958 sys_suspend_process(XINT(Fconsole_tty_controlling_process(console)));
959 }
960
961 UNGCPRO;
962 #endif
963 return Qnil;
964 }
965
966 DEFUN ("resume-console", Fresume_console, 1, 1, "", /*
967 Re-initialize a previously suspended console. For tty consoles,
968 do stuff to the tty to make it sane again.
969 */
970 (console))
971 {
972 Lisp_Object devcons;
973 Lisp_Object framecons;
974 struct console *c;
975 struct gcpro gcpro1, gcpro2, gcpro3;
976
977 #ifdef HAVE_TTY
978 GCPRO2 (console, devcons);
979
980 c = decode_console(console);
981
982 if (CONSOLE_TTY_P(c))
983 {
984 CONSOLE_DEVICE_LOOP (devcons, c)
985 {
986 struct device *d = XDEVICE (XCAR (devcons));
987 DEVICE_FRAME_LOOP (framecons, d)
988 {
989 Fmake_frame_visible(XCAR(framecons));
990 }
991 }
992 init_one_console(c);
993 }
994
995 UNGCPRO;
996 #endif
997 return Qnil;
998 }
999 906
1000 DEFUN ("set-input-mode", Fset_input_mode, 3, 5, 0, /* 907 DEFUN ("set-input-mode", Fset_input_mode, 3, 5, 0, /*
1001 Set mode of reading keyboard input. 908 Set mode of reading keyboard input.
1002 First arg is ignored, for backward compatibility. 909 First arg is ignored, for backward compatibility.
1003 Second arg FLOW non-nil means use ^S/^Q flow control for output to terminal 910 Second arg FLOW non-nil means use ^S/^Q flow control for output to terminal
1009 Optional fourth arg QUIT if non-nil specifies character to use for quitting. 916 Optional fourth arg QUIT if non-nil specifies character to use for quitting.
1010 Optional fifth arg CONSOLE specifies console to make changes to; nil means 917 Optional fifth arg CONSOLE specifies console to make changes to; nil means
1011 the selected console. 918 the selected console.
1012 See also `current-input-mode'. 919 See also `current-input-mode'.
1013 */ 920 */
1014 (ignored, flow, meta, quit, console)) 921 (ignored, flow, meta, quit, console))
1015 { 922 {
1016 struct console *con = decode_console (console); 923 struct console *con = decode_console (console);
1017 int meta_key = 1; 924 int meta_key = 1;
1018 925
1019 if (CONSOLE_TTY_P (con)) 926 if (CONSOLE_TTY_P (con))
1098 DEFSUBR (Fconsole_list); 1005 DEFSUBR (Fconsole_list);
1099 DEFSUBR (Fconsole_device_list); 1006 DEFSUBR (Fconsole_device_list);
1100 DEFSUBR (Fconsole_enable_input); 1007 DEFSUBR (Fconsole_enable_input);
1101 DEFSUBR (Fconsole_disable_input); 1008 DEFSUBR (Fconsole_disable_input);
1102 DEFSUBR (Fconsole_on_window_system_p); 1009 DEFSUBR (Fconsole_on_window_system_p);
1103 DEFSUBR (Fsuspend_console); 1010
1104 DEFSUBR (Fresume_console);
1105
1106 DEFSUBR (Fsuspend_emacs); 1011 DEFSUBR (Fsuspend_emacs);
1107 DEFSUBR (Fset_input_mode); 1012 DEFSUBR (Fset_input_mode);
1108 DEFSUBR (Fcurrent_input_mode); 1013 DEFSUBR (Fcurrent_input_mode);
1109 1014
1110 defsymbol (&Qconsolep, "consolep"); 1015 defsymbol (&Qconsolep, "consolep");