Commit 2246281f authored by Karoly Lorentey's avatar Karoly Lorentey

Support for opening X frames from a tty session.

lisp/cus-face.el (custom-declare-face): Handle multiple concurrent
display methods correctly.

lisp/faces.el (x-create-frame-with-faces): Set the window-system frame
parameter instead of frame-creation-function.
(tty-create-frame-with-faces): Ditto.

lisp/frame.el (frame-creation-function): Removed.
(frame-creation-function-alist): New variable.
(frame-initialize): Use initial-window-system instead of window-system.
Add window-system parameter to initial-frame-alist.
Removed tty initialization, it was moved to frame-creation-function-alist.
(frame-notice-user-settings): Use initial-window-system instead of window-system.
(make-frame-on-display): Make sure term/x-win is loaded.  Added
window-system parameter for make-frame.
(make-frame-on-tty): Removed unnecessary autoload declaration.  Added
window-system parameter for make-frame.
(make-frame): Use frame-creation-function-alist to determine the
function to use depending on the specified window system.
(select-frame-by-name): Use the window-system function instead of the
variable.

lisp/startup.el (window-system):  New variable (previously built-in,
now frame-local).
(normal-top-level, command-line): Use initial-window-system instead
of window-system.

lisp/loadup.el:  Load startup.el before faces.el, for the
window-system variable.

lisp/term/x-win.el: Check for the x-create-frame function instead of
window-system to see if X is available.  Don't exit Emacs if the
display can not be opened when X is not the initial display method.
Set up frame-creation-function-alist instead of
frame-creation-function.  Provide the x-win feature.

src/dispnew.c (Vwindow_system): Renamed to Vinitial_window_system.
(init_display, syms_of_display): Updated to use Vinitial_window_system
instead of Vwindow_system.

src/emacs.c (shut_down_emacs): Updated to use Vinitial_window_system
instead of Vwindow_system.

src/keyboard.c (Fset_input_mode): Call reset_all_sys_modes, not
reset_sys_modes.  Ditto for init_all_sys_modes.  Process the quit
parameter correctly.

src/sysdep.c (init_sys_modes, reset_sys_modes): Unconditionally set up
the terminal.  We don't get called if there is nothing to do anymore.
(sys_select): Use Vinitial_window_system, not Vwindow_system.

src/window.h (Vwindow_system): Renamed to Vinitial_window_system.

src/xfns.c (Fx_create_frame): Don't check_x.  We initialize it anyway.
(x_display_info_for_name, Fx_open_connection): Don't look at
Vinitial_window_system.

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-54
parent c0707982
......@@ -2,9 +2,9 @@
GOAL
----
The ultimate goal of this branch is to implement support for opening
multiple, different tty devices and simultaneous X and tty frames from
a single Emacs session.
The goal of this branch is to implement support for opening multiple,
different tty devices and simultaneous X and tty frames from a single
Emacs session.
Some use cases:
......@@ -27,7 +27,7 @@ WHO IS DOING IT
I'm Károly Lőrentey. My address: lorentey@elte.hu.
Patches or suggestions are welcome!
Comments, bug reports, suggestions and patches are welcome!
Retrieving the latest version of the branch:
......@@ -46,9 +46,13 @@ STATUS
------
Multi-tty support is stable, I think most of the problems were fixed.
(It still needs testing on other architectures, though.) Please let
me know if you find any bugs in it. Emacsclient has been extended to
support opening a new terminal frame.
(It still needs testing on other architectures, though.) Simultaneous
X and tty frame support works fine, although there are some small
issues. Emacsclient has been extended to support opening a new
terminal frame.
Please let me know if you find any bugs in this branch.
To try it out, compile and run the multi-tty branch with the following
commands:
......@@ -57,7 +61,7 @@ commands:
cd +build
../configure
make bootstrap
src/emacs -nw
src/emacs -nw # You can also try without -nw
M-x server-start
and then (from a shell prompt on another terminal) start emacsclient
......@@ -77,7 +81,7 @@ all terminals should be restored to their previous states.
This is work in progress, and probably full of bugs. You should
always run emacs from gdb, so that you'll have a live instance to
debug if something goes wrong. Please send me your reports.
debug if something goes wrong. Please send me your bug reports.
Problems:
......@@ -85,39 +89,48 @@ Problems:
devices. Also, there is no way to suspend emacsclient. This
will be fixed.
* X support is (I hope) working, but at the moment there are
problems with simultaneous X and tty devices, so don't do
that - start a separate Emacs with -nw and run the server
there.
* Mac, Windows and DOS support is broken, probably doesn't
even compile -- this will be solved later.
* Only tested on my GNU/Linux box.
* Only tested on my GNU/Linux box and on Solaris 8.
NEWS
----
For the NEWS file:
** Support for multiple terminal devices has been added. You can
specify a terminal device (`tty' parameter) and a terminal type
(`tty-type' parameter) to `make-terminal-frame'. `tty' must be a
terminal device created by the updated emacsclient, or there will
be problems with terminal input and window resizes.
** Support for multiple terminal devices has been added.
You can test for the presence of multiple terminal support by
testing for the `multi-tty' feature.
*** You can specify a terminal device (`tty' parameter) and a terminal
type (`tty-type' parameter) to `make-terminal-frame'.
** A make-frame-on-tty function has been added to make it easier to
create frames on new terminals.
*** You can test for the presence of multiple terminal support by
testing for the `multi-tty' feature.
** New functions: frame-tty-name, frame-tty-type for accessing
terminal parameters, and delete-tty for closing the terminal
device.
*** Emacsclient has been extended to support opening a new terminal
frame (see -t option).
*** A make-frame-on-tty function has been added to make it easier to
create frames on new terminals.
*** New functions: frame-tty-name, frame-tty-type for accessing
terminal parameters, and delete-tty for closing the terminal
device.
*** talk.el has been extended for multiple tty support.
** Support for simultaneous graphical and terminal frames has been
added.
*** The function `make-frame-on-display' now works during a terminal
session, and `make-frame-on-tty' works during a graphical session.
*** The `window-system' variable has been made frame-local.
*** The new `initial-window-system' variable contains the
`window-system' value for the first frame.
** Emacsclient has been extended to support opening a new terminal
frame.
CHANGELOG
---------
......@@ -127,11 +140,13 @@ See arch logs.
THINGS TO DO
------------
** Fix color handling during X+tty combo sessions. (It seems that tty
** Fix color handling during tty+X combo sessions. (It seems that tty
sessions automatically convert the face colors to terminal colors
when the face is loaded. This conversion must happen instead on
the fly in write_glyphs, which might be problematic, as color
approximation is currently done in lisp (term/tty-colors.el).)
(Update: hm, colors seem to work fine if I start emacs with -nw and
then create an X frame. Maybe it's just a small buglet somewhere.)
** Fix interactive use of temacs. There are face-related SEGVs, most
likely because of changes in realize_default_face, realize_face.
......@@ -139,17 +154,12 @@ THINGS TO DO
** Very strange bug: visible-bell does not work on secondary
terminals. This might be something xterm (konsole) specific.
** Allow opening an X session after -nw.
** Find out the best way to support suspending Emacs with multiple
ttys. My guess: disable it on the controlling tty, but from other
ttys pass it on to emacsclient somehow. (It is (I hope) trivial to
extend emacsclient to handle suspend/resume. A `kill -STOP' almost
works right now.)
** Exiting Emacs while there are emacsclient frames doesn't restore the
ttys to their default states.
** Move baud_rate to struct display.
** Implement support for starting an interactive Emacs session without
......@@ -187,6 +197,8 @@ THINGS TO DO
single_kboard mode, and is not easily solvable. The best thing to
do is to simply refuse to create a tty frame of type `eterm'.
** Maybe standard-display-table should be display-local.
DIARY OF CHANGES
----------------
......@@ -545,4 +557,14 @@ DIARY OF CHANGES
Note that the above strace output seems to be an unrelated but
similar bug. I think that is now fixed.)
-- Exiting Emacs while there are emacsclient frames doesn't restore the
ttys to their default states.
(This seems to be fixed by some previous change.)
-- Allow opening an X session after -nw.
(Done.)
;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
......@@ -41,6 +41,7 @@
;; If the user has already created the face, respect that.
(let ((value (or (get face 'saved-face) spec))
(frames (frame-list))
(have-window-system (memq initial-window-system '(x w32)))
frame)
;; Create global face.
(make-empty-face face)
......@@ -48,10 +49,12 @@
(while frames
(setq frame (car frames)
frames (cdr frames))
(face-spec-set face value frame)))
;; When making a face after frames already exist
(if (memq window-system '(x w32))
(make-face-x-resource-internal face))))
(face-spec-set face value frame)
(when (memq (window-system frame) '(x w32))
(setq have-window-system t)))
;; When making a face after frames already exist
(if have-window-system
(make-face-x-resource-internal face)))))
;; Don't record SPEC until we see it causes no errors.
(put face 'face-defface-spec spec)
(when (and doc (null (face-documentation face)))
......
......@@ -1658,8 +1658,7 @@ Value is the new frame created."
(setq parameters (x-handle-named-frame-geometry parameters))
(let ((visibility-spec (assq 'visibility parameters))
(frame-list (frame-list))
(frame (x-create-frame `((frame-creation-function . x-create-frame-with-faces)
(visibility . nil) . ,parameters)))
(frame (x-create-frame `((window-system . x) (visibility . nil) . ,parameters)))
success)
(unwind-protect
(progn
......@@ -1745,8 +1744,7 @@ Parameters not specified by PARAMETERS are taken from
`default-frame-alist'. If either PARAMETERS or `default-frame-alist'
contains a `reverse' parameter, handle that. Value is the new frame
created."
(let ((frame (make-terminal-frame `((frame-creation-function . tty-create-frame-with-faces) .
,parameters)))
(let ((frame (make-terminal-frame `((window-system . nil) . ,parameters)))
success)
(unwind-protect
(progn
......
......@@ -27,12 +27,17 @@
;;; Code:
(defvar frame-creation-function nil
"Window-system dependent function to call to create a new frame.
The window system startup file should set this to its frame creation
function, which should take an alist of parameters as its argument.")
(make-variable-frame-local 'frame-creation-function)
(defvar frame-creation-function-alist
(list (cons nil
(if (fboundp 'tty-create-frame-with-faces)
'tty-create-frame-with-faces
(function
(lambda (parameters)
(error "Can't create multiple frames without a window system"))))))
"Alist of window-system dependent functions to call to create a new frame.
The window system startup file should add its frame creation
function to this list, which should take an alist of parameters
as its argument.")
;; The initial value given here used to ask for a minibuffer.
;; But that's not necessary, because the default is to have one.
......@@ -188,7 +193,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
(defun frame-initialize ()
"Create an initial frame if necessary."
;; Are we actually running under a window system at all?
(if (and window-system (not noninteractive) (not (eq window-system 'pc)))
(if (and initial-window-system
(not noninteractive)
(not (eq initial-window-system 'pc)))
(progn
;; Turn on special-display processing only if there's a window system.
(setq special-display-function 'special-display-popup-frame)
......@@ -205,6 +212,9 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
(setq frame-initial-frame-alist
(cons '(horizontal-scroll-bars . t)
frame-initial-frame-alist)))
(setq frame-initial-frame-alist
(cons (cons 'window-system initial-window-system)
frame-initial-frame-alist))
(setq default-minibuffer-frame
(setq frame-initial-frame
(make-frame frame-initial-frame-alist)))
......@@ -217,18 +227,7 @@ Pass it BUFFER as first arg, and (cdr ARGS) gives the rest of the args."
;; At this point, we know that we have a frame open, so we
;; can delete the terminal frame.
(delete-frame terminal-frame)
(setq terminal-frame nil))
;; No, we're not running a window system. Use make-terminal-frame if
;; we support that feature, otherwise arrange to cause errors.
(or (eq window-system 'pc)
(setq frame-creation-function
(if (fboundp 'tty-create-frame-with-faces)
'tty-create-frame-with-faces
(function
(lambda (parameters)
(error
"Can't create multiple frames without a window system"))))))))
(setq terminal-frame nil))))
(defvar frame-notice-user-settings t
"Non-nil means function `frame-notice-user-settings' wasn't run yet.")
......@@ -278,7 +277,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
;; Can't modify the minibuffer parameter, so don't try.
(setq parms (delq (assq 'minibuffer parms) parms))
(modify-frame-parameters nil
(if (null window-system)
(if (null initial-window-system)
(append initial-frame-alist
default-frame-alist
parms
......@@ -287,7 +286,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there."
;; default-frame-alist were already
;; applied in pc-win.el.
parms))
(if (null window-system) ;; MS-DOS does this differently in pc-win.el
(if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el
(let ((newparms (frame-parameters))
(frame (selected-frame)))
(tty-handle-reverse-video frame newparms)
......@@ -571,26 +570,18 @@ The optional second argument PARAMETERS specifies additional frame parameters."
(interactive "sMake frame on display: ")
(or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display)
(error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN"))
(make-frame (cons (cons 'display display) parameters)))
(load (concat term-file-prefix "x-win"))
(make-frame `((window-system . x) (display . ,display) . ,parameters)))
;;;###autoload
(defun make-frame-on-tty (device type &optional parameters)
"Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\").
The optional third argument PARAMETERS specifies additional frame parameters.
DEVICE must be a proxy psudo terminal created by emacsclient,
otherwise there will be problems with terminal input and window
resizes. (The kernel notifies processes about pending input or
terminal resizes only on the controlling terminal, so we need
emacsclient to sit on the real terminal device, create SIGIO
signals upon terminal input, and forward SIGWINCH signals to
us.)"
The optional third argument PARAMETERS specifies additional frame parameters."
(interactive "fOpen frame on tty device: \nsTerminal type of %s: ")
(unless device
(error "Invalid terminal device"))
(unless type
(error "Invalid terminal type"))
(tty-create-frame-with-faces (append (list (cons 'tty device) (cons 'tty-type type)) parameters)))
(make-frame `((window-system . nil) (tty . ,device) (tty-type . ,type) . ,parameters)))
(defun make-frame-command ()
"Make a new frame, and select it if the terminal displays only one frame."
......@@ -630,12 +621,22 @@ You cannot specify either `width' or `height', you must use neither or both.
(minibuffer . only) The frame should contain only a minibuffer.
(minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window.
Before the frame is created (via `frame-creation-function'), functions on the
(window-system . nil) The frame should be displayed on a terminal device.
(window-system . x) The frame should be displayed in an X window.
Before the frame is created (via `frame-creation-function-alist'), functions on the
hook `before-make-frame-hook' are run. After the frame is created, functions
on `after-make-frame-functions' are run with one arg, the newly created frame."
(interactive)
(run-hooks 'before-make-frame-hook)
(let ((frame (funcall frame-creation-function parameters)))
(let* ((w (if (assq 'window-system parameters)
(cdr (assq 'window-system parameters))
window-system))
(frame-creation-function (cdr (assq w frame-creation-function-alist)))
frame)
(unless frame-creation-function
(error "Don't know how to create a frame on window system %s" w))
(run-hooks 'before-make-frame-hook)
(funcall frame-creation-function parameters)
(run-hook-with-args 'after-make-frame-functions frame)
frame))
......@@ -780,9 +781,9 @@ If there is no frame by that name, signal an error."
(raise-frame frame)
(select-frame frame)
;; Ensure, if possible, that frame gets input focus.
(cond ((eq window-system 'x)
(cond ((eq (window-system frame) 'x)
(x-focus-frame frame))
((eq window-system 'w32)
((eq (window-system frame) 'w32)
(w32-focus-frame frame)))
(when focus-follows-mouse
(set-mouse-position frame (1- (frame-width frame)) 0))))
......
......@@ -67,6 +67,8 @@
(setq load-source-file-function 'load-with-code-conversion)
(load "files")
(load "startup")
(load "cus-face")
(load "faces") ; after here, `defface' may be used.
......@@ -146,7 +148,6 @@
(message "%s" (garbage-collect))
(load "menu-bar")
(load "paths.el") ;Don't get confused if someone compiled paths by mistake.
(load "startup")
(load "emacs-lisp/lisp")
(load "textmodes/page")
(load "register")
......
......@@ -128,6 +128,13 @@
(defvar command-line-processed nil
"Non-nil once command line has been processed.")
(defvar window-system initial-window-system
"Name of window system the selected frame is displaying through.
The value is a symbol--for instance, `x' for X windows.
The value is nil if the selected frame is on a text-only-terminal.")
(make-variable-frame-local 'window-system)
(defgroup initialization nil
"Emacs start-up procedure"
:group 'internal)
......@@ -512,9 +519,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
;; for instance due to a dense colormap.
(when (or frame-initial-frame
;; If frame-initial-frame has no meaning, do this anyway.
(not (and window-system
(not (and initial-window-system
(not noninteractive)
(not (eq window-system 'pc)))))
(not (eq initial-window-system 'pc)))))
;; Modify the initial frame based on what .emacs puts into
;; ...-frame-alist.
(if (fboundp 'frame-notice-user-settings)
......@@ -527,7 +534,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
(let ((frame-background-mode frame-background-mode)
(frame (selected-frame))
term)
(when (and (null window-system)
(when (and (null initial-window-system)
;; Don't override a possibly customized value.
(null frame-background-mode)
;; Don't override user specifications.
......@@ -702,9 +709,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
;; Read window system's init file if using a window system.
(condition-case error
(if (and window-system (not noninteractive))
(if (and initial-window-system (not noninteractive))
(load (concat term-file-prefix
(symbol-name window-system)
(symbol-name initial-window-system)
"-win")
;; Every window system should have a startup file;
;; barf if we can't find it.
......@@ -725,7 +732,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
(cdr error) ", "))))
'external-debugging-output)
(terpri 'external-debugging-output)
(setq window-system nil)
(setq initial-window-system nil)
(kill-emacs)))
;; Windowed displays do this inside their *-win.el.
......@@ -808,7 +815,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
;; If frame was created with a menu bar, set menu-bar-mode on.
(unless (or noninteractive
(and (memq window-system '(x w32))
(and (memq initial-window-system '(x w32))
(<= (frame-parameter nil 'menu-bar-lines) 0)))
(menu-bar-mode 1))
......@@ -818,10 +825,10 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
(<= (frame-parameter nil 'tool-bar-lines) 0))
(tool-bar-mode 1))
;; Can't do this init in defcustom because window-system isn't set.
;; Can't do this init in defcustom because initial-window-system isn't set.
(unless (or noninteractive
(eq system-type 'ms-dos)
(not (memq window-system '(x w32))))
(not (memq initial-window-system '(x w32))))
(setq-default blink-cursor t)
(blink-cursor-mode 1))
......@@ -829,13 +836,13 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
;; DOS/Windows systems have a PC-type keyboard which has both
;; <delete> and <backspace> keys.
(when (or (memq system-type '(ms-dos windows-nt))
(and (memq window-system '(x))
(and (memq initial-window-system '(x))
(fboundp 'x-backspace-delete-keys-p)
(x-backspace-delete-keys-p))
;; If the terminal Emacs is running on has erase char
;; set to ^H, use the Backspace key for deleting
;; backward and, and the Delete key for deleting forward.
(and (null window-system)
(and (null initial-window-system)
(eq tty-erase-char 8)))
(setq-default normal-erase-is-backspace t)
(normal-erase-is-backspace-mode 1)))
......@@ -848,7 +855,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
;; Register default TTY colors for the case the terminal hasn't a
;; terminal init file.
(unless (memq window-system '(x w32))
(unless (memq initial-window-system '(x w32))
;; We do this regardles of whether the terminal supports colors
;; or not, since they can switch that support on or off in
;; mid-session by setting the tty-color-mode frame parameter.
......@@ -1046,7 +1053,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
;; Load library for our terminal type.
;; User init file can set term-file-prefix to nil to prevent this.
(unless (or noninteractive
window-system
initial-window-system
(null term-file-prefix))
(let ((term (getenv "TERM"))
hyphend)
......
......@@ -66,7 +66,7 @@
;; An alist of X options and the function which handles them. See
;; ../startup.el.
(if (not (eq window-system 'x))
(if (not (fboundp 'x-create-frame))
(error "%s: Loading x-win.el but not compiled for X" (invocation-name)))
(require 'frame)
......@@ -1159,6 +1159,7 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp")
;;;; Function keys
;;; XXX This might be wrong with multi-tty support.
(substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
global-map)
......@@ -2346,10 +2347,11 @@ order until succeed.")
(x-open-connection (or x-display-name
(setq x-display-name (getenv "DISPLAY")))
x-command-line-resources
;; Exit Emacs with fatal error if this fails.
t)
;; Exit Emacs with fatal error if this fails and we
;; are the initial display.
(eq initial-window-system 'x))
(setq frame-creation-function 'x-create-frame-with-faces)
(add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces))
(setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
x-cut-buffer-max))
......@@ -2431,6 +2433,7 @@ order until succeed.")
(if res-selection-timeout
(setq x-selection-timeout (string-to-number res-selection-timeout))))
;; XXX This is wrong with multi-tty support.
(defun x-win-suspend-error ()
(error "Suspending an Emacs running under X makes no sense"))
(add-hook 'suspend-hook 'x-win-suspend-error)
......@@ -2453,5 +2456,7 @@ order until succeed.")
;; Turn on support for mouse wheels.
(mouse-wheel-mode 1)
(provide 'x-win)
;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
;;; x-win.el ends here
......@@ -214,9 +214,9 @@ int inverse_video;
EMACS_INT baud_rate;
/* Either nil or a symbol naming the window system under which Emacs
is running. */
creates the first frame. */
Lisp_Object Vwindow_system;
Lisp_Object Vinitial_window_system;
/* Version number of X windows: 10, 11 or nil. */
......@@ -6569,7 +6569,7 @@ init_display ()
/* Now is the time to initialize this; it's used by init_sys_modes
during startup. */
Vwindow_system = Qnil;
Vinitial_window_system = Qnil;
/* If the user wants to use a window system, we shouldn't bother
initializing the terminal. This is especially important when the
......@@ -6598,7 +6598,7 @@ init_display ()
#endif
)
{
Vwindow_system = intern ("x");
Vinitial_window_system = intern ("x");
#ifdef HAVE_X11
Vwindow_system_version = make_number (11);
#else
......@@ -6618,7 +6618,7 @@ init_display ()
#ifdef HAVE_NTGUI
if (!inhibit_window_system)
{
Vwindow_system = intern ("w32");
Vinitial_window_system = intern ("w32");
Vwindow_system_version = make_number (1);
adjust_frame_glyphs_initially ();
return;
......@@ -6628,7 +6628,7 @@ init_display ()
#ifdef MAC_OS
if (!inhibit_window_system)
{
Vwindow_system = intern ("mac");
Vinitial_window_system = intern ("mac");
Vwindow_system_version = make_number (1);
adjust_frame_glyphs_initially ();
return;
......@@ -6730,7 +6730,7 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\
and internal_terminal_init. */
&& (strcmp (terminal_type, "internal") != 0 || inhibit_window_system)
#endif
&& NILP (Vwindow_system))
&& NILP (Vinitial_window_system))
{
/* For the initial frame, we don't have any way of knowing what
are the foreground and background colors of the terminal. */
......@@ -6842,8 +6842,8 @@ A non-nil value is useful if the terminal can automatically preserve
Emacs's frame display when you reenter Emacs.
It is up to you to set this variable if your terminal can do that. */);
DEFVAR_LISP ("window-system", &Vwindow_system,
doc: /* Name of window system that Emacs is displaying through.
DEFVAR_LISP ("initial-window-system", &Vinitial_window_system,
doc: /* Name of the window system that Emacs uses for the first frame.
The value is a symbol--for instance, `x' for X windows.
The value is nil if Emacs is using a text-only terminal. */);
......@@ -6879,7 +6879,7 @@ See `buffer-display-table' for more information. */);
if (noninteractive)
#endif
{
Vwindow_system = Qnil;
Vinitial_window_system = Qnil;
Vwindow_system_version = Qnil;
}
}
......
......@@ -192,7 +192,7 @@ int display_arg;
char *stack_bottom;
#ifdef HAVE_WINDOW_SYSTEM
extern Lisp_Object Vwindow_system;
extern Lisp_Object Vinitial_window_system;
#endif /* HAVE_WINDOW_SYSTEM */
extern Lisp_Object Vauto_save_list_file_name;
......@@ -2017,9 +2017,9 @@ shut_down_emacs (sig, no_x, stuff)
#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */
#ifdef HAVE_X_WINDOWS
/* It's not safe to call intern here. Maybe we are crashing. */
if (!noninteractive && SYMBOLP (Vwindow_system)
&& SCHARS (SYMBOL_NAME (Vwindow_system)) == 1
&& SREF (SYMBOL_NAME (Vwindow_system), 0) == 'x'
if (!noninteractive && SYMBOLP (Vinitial_window_system)
&& SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1
&& SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x'
&& ! no_x)
Fx_close_current_connection ();
#endif /* HAVE_X_WINDOWS */
......
......@@ -10503,8 +10503,7 @@ See also `current-input-mode'. */)
#ifndef DOS_NT
/* this causes startup screen to be restored and messes with the mouse */
if (FRAME_TERMCAP_P (SELECTED_FRAME ()))
reset_sys_modes (CURTTY ());
reset_all_sys_modes ();
#endif
#ifdef SIGIO
......@@ -10542,13 +10541,12 @@ See also `current-input-mode'. */)
tty->meta_key = 2;
}
if (FRAME_TERMCAP_P (XFRAME (selected_frame)) && !NILP (quit))
if (!NILP (quit))
/* Don't let this value be out of range. */
quit_char = XINT (quit) & (CURTTY ()->meta_key ? 0377 : 0177);
quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377);
#ifndef DOS_NT
if (FRAME_TERMCAP_P (XFRAME (selected_frame)) && CURTTY ()->type)
init_sys_modes (CURTTY ());
init_all_sys_modes ();
#endif
#ifdef POLL_FOR_INPUT
......
This diff is collapsed.
......@@ -744,7 +744,7 @@ extern Lisp_Object Vminibuf_scroll_window;
/* Nil or a symbol naming the window system under which emacs is
running ('x is the only current possibility) */
extern Lisp_Object Vwindow_system;
extern Lisp_Object Vinitial_window_system;
/* Version number of X windows: 10, 11 or nil. */
......
......@@ -3188,8 +3188,6 @@ This function is an internal primitive--use `make-frame' instead. */)
Lisp_Object parent;
struct kboard *kb;
check_x ();
/* Use this general default value to start with
until we know if this frame has a specified name. */
Vx_resource_name = Vinvocation_name;
......@@ -4124,8 +4122,10 @@ x_display_info_for_name (name)
CHECK_STRING (name);
if (! EQ (Vwindow_system, intern ("x")))
error ("Not using X Windows");
#if 0
if (! EQ (Vinitial_window_system, intern ("x")))
error ("Not using X Windows"); /* That doesn't stop us anymore. */
#endif
for (dpyinfo = x_display_list, names = x_display_name_list;
dpyinfo;
......@@ -4172,8 +4172,10 @@ terminate Emacs if we can't open the connection. */)
if (! NILP (xrm_string))
CHECK_STRING (xrm_string);
if (! EQ (Vwindow_system, intern ("x")))
error ("Not using X Windows");
#if 0
if (! EQ (Vinitial_window_system, intern ("x")))
error ("Not using X Windows"); /* That doesn't stop us anymore. */
#endif
if (! NILP (xrm_string))
xrm_option = (unsigned char *) SDATA (xrm_string);
......