diff options
| author | Karoly Lorentey | 2004-01-11 21:59:40 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-01-11 21:59:40 +0000 |
| commit | 2246281fb0e2ab610d14efa7166a9ceb02597643 (patch) | |
| tree | 09416af10eec00f4d43af0dd569cc90cda408ce6 | |
| parent | c0707982ab8a080139a45b35fc7906415ba2f1bc (diff) | |
| download | emacs-2246281fb0e2ab610d14efa7166a9ceb02597643.tar.gz emacs-2246281fb0e2ab610d14efa7166a9ceb02597643.zip | |
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
| -rw-r--r-- | README.multi-tty | 92 | ||||
| -rw-r--r-- | lisp/cus-face.el | 11 | ||||
| -rw-r--r-- | lisp/faces.el | 6 | ||||
| -rw-r--r-- | lisp/frame.el | 77 | ||||
| -rw-r--r-- | lisp/loadup.el | 3 | ||||
| -rw-r--r-- | lisp/startup.el | 33 | ||||
| -rw-r--r-- | lisp/term/x-win.el | 13 | ||||
| -rw-r--r-- | src/dispnew.c | 20 | ||||
| -rw-r--r-- | src/emacs.c | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 10 | ||||
| -rw-r--r-- | src/sysdep.c | 360 | ||||
| -rw-r--r-- | src/window.h | 2 | ||||
| -rw-r--r-- | src/xfns.c | 14 |
13 files changed, 326 insertions, 323 deletions
diff --git a/README.multi-tty b/README.multi-tty index 816f0090377..42e1867d98e 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -2,9 +2,9 @@ | |||
| 2 | GOAL | 2 | GOAL |
| 3 | ---- | 3 | ---- |
| 4 | 4 | ||
| 5 | The ultimate goal of this branch is to implement support for opening | 5 | The goal of this branch is to implement support for opening multiple, |
| 6 | multiple, different tty devices and simultaneous X and tty frames from | 6 | different tty devices and simultaneous X and tty frames from a single |
| 7 | a single Emacs session. | 7 | Emacs session. |
| 8 | 8 | ||
| 9 | Some use cases: | 9 | Some use cases: |
| 10 | 10 | ||
| @@ -27,7 +27,7 @@ WHO IS DOING IT | |||
| 27 | 27 | ||
| 28 | I'm Károly Lőrentey. My address: lorentey@elte.hu. | 28 | I'm Károly Lőrentey. My address: lorentey@elte.hu. |
| 29 | 29 | ||
| 30 | Patches or suggestions are welcome! | 30 | Comments, bug reports, suggestions and patches are welcome! |
| 31 | 31 | ||
| 32 | Retrieving the latest version of the branch: | 32 | Retrieving the latest version of the branch: |
| 33 | 33 | ||
| @@ -46,9 +46,13 @@ STATUS | |||
| 46 | ------ | 46 | ------ |
| 47 | 47 | ||
| 48 | Multi-tty support is stable, I think most of the problems were fixed. | 48 | Multi-tty support is stable, I think most of the problems were fixed. |
| 49 | (It still needs testing on other architectures, though.) Please let | 49 | (It still needs testing on other architectures, though.) Simultaneous |
| 50 | me know if you find any bugs in it. Emacsclient has been extended to | 50 | X and tty frame support works fine, although there are some small |
| 51 | support opening a new terminal frame. | 51 | issues. Emacsclient has been extended to support opening a new |
| 52 | terminal frame. | ||
| 53 | |||
| 54 | |||
| 55 | Please let me know if you find any bugs in this branch. | ||
| 52 | 56 | ||
| 53 | To try it out, compile and run the multi-tty branch with the following | 57 | To try it out, compile and run the multi-tty branch with the following |
| 54 | commands: | 58 | commands: |
| @@ -57,7 +61,7 @@ commands: | |||
| 57 | cd +build | 61 | cd +build |
| 58 | ../configure | 62 | ../configure |
| 59 | make bootstrap | 63 | make bootstrap |
| 60 | src/emacs -nw | 64 | src/emacs -nw # You can also try without -nw |
| 61 | M-x server-start | 65 | M-x server-start |
| 62 | 66 | ||
| 63 | and then (from a shell prompt on another terminal) start emacsclient | 67 | and then (from a shell prompt on another terminal) start emacsclient |
| @@ -77,7 +81,7 @@ all terminals should be restored to their previous states. | |||
| 77 | 81 | ||
| 78 | This is work in progress, and probably full of bugs. You should | 82 | This is work in progress, and probably full of bugs. You should |
| 79 | always run emacs from gdb, so that you'll have a live instance to | 83 | always run emacs from gdb, so that you'll have a live instance to |
| 80 | debug if something goes wrong. Please send me your reports. | 84 | debug if something goes wrong. Please send me your bug reports. |
| 81 | 85 | ||
| 82 | Problems: | 86 | Problems: |
| 83 | 87 | ||
| @@ -85,39 +89,48 @@ Problems: | |||
| 85 | devices. Also, there is no way to suspend emacsclient. This | 89 | devices. Also, there is no way to suspend emacsclient. This |
| 86 | will be fixed. | 90 | will be fixed. |
| 87 | 91 | ||
| 88 | * X support is (I hope) working, but at the moment there are | ||
| 89 | problems with simultaneous X and tty devices, so don't do | ||
| 90 | that - start a separate Emacs with -nw and run the server | ||
| 91 | there. | ||
| 92 | |||
| 93 | * Mac, Windows and DOS support is broken, probably doesn't | 92 | * Mac, Windows and DOS support is broken, probably doesn't |
| 94 | even compile -- this will be solved later. | 93 | even compile -- this will be solved later. |
| 95 | 94 | ||
| 96 | * Only tested on my GNU/Linux box. | 95 | * Only tested on my GNU/Linux box and on Solaris 8. |
| 97 | 96 | ||
| 98 | NEWS | 97 | NEWS |
| 99 | ---- | 98 | ---- |
| 100 | 99 | ||
| 101 | For the NEWS file: | 100 | For the NEWS file: |
| 102 | 101 | ||
| 103 | ** Support for multiple terminal devices has been added. You can | 102 | ** Support for multiple terminal devices has been added. |
| 104 | specify a terminal device (`tty' parameter) and a terminal type | ||
| 105 | (`tty-type' parameter) to `make-terminal-frame'. `tty' must be a | ||
| 106 | terminal device created by the updated emacsclient, or there will | ||
| 107 | be problems with terminal input and window resizes. | ||
| 108 | 103 | ||
| 109 | You can test for the presence of multiple terminal support by | 104 | *** You can specify a terminal device (`tty' parameter) and a terminal |
| 110 | testing for the `multi-tty' feature. | 105 | type (`tty-type' parameter) to `make-terminal-frame'. |
| 111 | 106 | ||
| 112 | ** A make-frame-on-tty function has been added to make it easier to | 107 | *** You can test for the presence of multiple terminal support by |
| 113 | create frames on new terminals. | 108 | testing for the `multi-tty' feature. |
| 114 | 109 | ||
| 115 | ** New functions: frame-tty-name, frame-tty-type for accessing | 110 | *** Emacsclient has been extended to support opening a new terminal |
| 116 | terminal parameters, and delete-tty for closing the terminal | 111 | frame (see -t option). |
| 117 | device. | 112 | |
| 113 | *** A make-frame-on-tty function has been added to make it easier to | ||
| 114 | create frames on new terminals. | ||
| 115 | |||
| 116 | *** New functions: frame-tty-name, frame-tty-type for accessing | ||
| 117 | terminal parameters, and delete-tty for closing the terminal | ||
| 118 | device. | ||
| 119 | |||
| 120 | *** talk.el has been extended for multiple tty support. | ||
| 121 | |||
| 122 | |||
| 123 | ** Support for simultaneous graphical and terminal frames has been | ||
| 124 | added. | ||
| 125 | |||
| 126 | *** The function `make-frame-on-display' now works during a terminal | ||
| 127 | session, and `make-frame-on-tty' works during a graphical session. | ||
| 128 | |||
| 129 | *** The `window-system' variable has been made frame-local. | ||
| 130 | |||
| 131 | *** The new `initial-window-system' variable contains the | ||
| 132 | `window-system' value for the first frame. | ||
| 118 | 133 | ||
| 119 | ** Emacsclient has been extended to support opening a new terminal | ||
| 120 | frame. | ||
| 121 | 134 | ||
| 122 | CHANGELOG | 135 | CHANGELOG |
| 123 | --------- | 136 | --------- |
| @@ -127,11 +140,13 @@ See arch logs. | |||
| 127 | THINGS TO DO | 140 | THINGS TO DO |
| 128 | ------------ | 141 | ------------ |
| 129 | 142 | ||
| 130 | ** Fix color handling during X+tty combo sessions. (It seems that tty | 143 | ** Fix color handling during tty+X combo sessions. (It seems that tty |
| 131 | sessions automatically convert the face colors to terminal colors | 144 | sessions automatically convert the face colors to terminal colors |
| 132 | when the face is loaded. This conversion must happen instead on | 145 | when the face is loaded. This conversion must happen instead on |
| 133 | the fly in write_glyphs, which might be problematic, as color | 146 | the fly in write_glyphs, which might be problematic, as color |
| 134 | approximation is currently done in lisp (term/tty-colors.el).) | 147 | approximation is currently done in lisp (term/tty-colors.el).) |
| 148 | (Update: hm, colors seem to work fine if I start emacs with -nw and | ||
| 149 | then create an X frame. Maybe it's just a small buglet somewhere.) | ||
| 135 | 150 | ||
| 136 | ** Fix interactive use of temacs. There are face-related SEGVs, most | 151 | ** Fix interactive use of temacs. There are face-related SEGVs, most |
| 137 | likely because of changes in realize_default_face, realize_face. | 152 | likely because of changes in realize_default_face, realize_face. |
| @@ -139,17 +154,12 @@ THINGS TO DO | |||
| 139 | ** Very strange bug: visible-bell does not work on secondary | 154 | ** Very strange bug: visible-bell does not work on secondary |
| 140 | terminals. This might be something xterm (konsole) specific. | 155 | terminals. This might be something xterm (konsole) specific. |
| 141 | 156 | ||
| 142 | ** Allow opening an X session after -nw. | ||
| 143 | |||
| 144 | ** Find out the best way to support suspending Emacs with multiple | 157 | ** Find out the best way to support suspending Emacs with multiple |
| 145 | ttys. My guess: disable it on the controlling tty, but from other | 158 | ttys. My guess: disable it on the controlling tty, but from other |
| 146 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to | 159 | ttys pass it on to emacsclient somehow. (It is (I hope) trivial to |
| 147 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost | 160 | extend emacsclient to handle suspend/resume. A `kill -STOP' almost |
| 148 | works right now.) | 161 | works right now.) |
| 149 | 162 | ||
| 150 | ** Exiting Emacs while there are emacsclient frames doesn't restore the | ||
| 151 | ttys to their default states. | ||
| 152 | |||
| 153 | ** Move baud_rate to struct display. | 163 | ** Move baud_rate to struct display. |
| 154 | 164 | ||
| 155 | ** Implement support for starting an interactive Emacs session without | 165 | ** Implement support for starting an interactive Emacs session without |
| @@ -187,6 +197,8 @@ THINGS TO DO | |||
| 187 | single_kboard mode, and is not easily solvable. The best thing to | 197 | single_kboard mode, and is not easily solvable. The best thing to |
| 188 | do is to simply refuse to create a tty frame of type `eterm'. | 198 | do is to simply refuse to create a tty frame of type `eterm'. |
| 189 | 199 | ||
| 200 | ** Maybe standard-display-table should be display-local. | ||
| 201 | |||
| 190 | DIARY OF CHANGES | 202 | DIARY OF CHANGES |
| 191 | ---------------- | 203 | ---------------- |
| 192 | 204 | ||
| @@ -545,4 +557,14 @@ DIARY OF CHANGES | |||
| 545 | Note that the above strace output seems to be an unrelated but | 557 | Note that the above strace output seems to be an unrelated but |
| 546 | similar bug. I think that is now fixed.) | 558 | similar bug. I think that is now fixed.) |
| 547 | 559 | ||
| 560 | -- Exiting Emacs while there are emacsclient frames doesn't restore the | ||
| 561 | ttys to their default states. | ||
| 562 | |||
| 563 | (This seems to be fixed by some previous change.) | ||
| 564 | |||
| 565 | -- Allow opening an X session after -nw. | ||
| 566 | |||
| 567 | (Done.) | ||
| 568 | |||
| 569 | |||
| 548 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d | 570 | ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d |
diff --git a/lisp/cus-face.el b/lisp/cus-face.el index 1ff07c4c361..b5716da161a 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | ;; If the user has already created the face, respect that. | 41 | ;; If the user has already created the face, respect that. |
| 42 | (let ((value (or (get face 'saved-face) spec)) | 42 | (let ((value (or (get face 'saved-face) spec)) |
| 43 | (frames (frame-list)) | 43 | (frames (frame-list)) |
| 44 | (have-window-system (memq initial-window-system '(x w32))) | ||
| 44 | frame) | 45 | frame) |
| 45 | ;; Create global face. | 46 | ;; Create global face. |
| 46 | (make-empty-face face) | 47 | (make-empty-face face) |
| @@ -48,10 +49,12 @@ | |||
| 48 | (while frames | 49 | (while frames |
| 49 | (setq frame (car frames) | 50 | (setq frame (car frames) |
| 50 | frames (cdr frames)) | 51 | frames (cdr frames)) |
| 51 | (face-spec-set face value frame))) | 52 | (face-spec-set face value frame) |
| 52 | ;; When making a face after frames already exist | 53 | (when (memq (window-system frame) '(x w32)) |
| 53 | (if (memq window-system '(x w32)) | 54 | (setq have-window-system t))) |
| 54 | (make-face-x-resource-internal face)))) | 55 | ;; When making a face after frames already exist |
| 56 | (if have-window-system | ||
| 57 | (make-face-x-resource-internal face))))) | ||
| 55 | ;; Don't record SPEC until we see it causes no errors. | 58 | ;; Don't record SPEC until we see it causes no errors. |
| 56 | (put face 'face-defface-spec spec) | 59 | (put face 'face-defface-spec spec) |
| 57 | (when (and doc (null (face-documentation face))) | 60 | (when (and doc (null (face-documentation face))) |
diff --git a/lisp/faces.el b/lisp/faces.el index 42abb1e7ac4..4877fd246e0 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1658,8 +1658,7 @@ Value is the new frame created." | |||
| 1658 | (setq parameters (x-handle-named-frame-geometry parameters)) | 1658 | (setq parameters (x-handle-named-frame-geometry parameters)) |
| 1659 | (let ((visibility-spec (assq 'visibility parameters)) | 1659 | (let ((visibility-spec (assq 'visibility parameters)) |
| 1660 | (frame-list (frame-list)) | 1660 | (frame-list (frame-list)) |
| 1661 | (frame (x-create-frame `((frame-creation-function . x-create-frame-with-faces) | 1661 | (frame (x-create-frame `((window-system . x) (visibility . nil) . ,parameters))) |
| 1662 | (visibility . nil) . ,parameters))) | ||
| 1663 | success) | 1662 | success) |
| 1664 | (unwind-protect | 1663 | (unwind-protect |
| 1665 | (progn | 1664 | (progn |
| @@ -1745,8 +1744,7 @@ Parameters not specified by PARAMETERS are taken from | |||
| 1745 | `default-frame-alist'. If either PARAMETERS or `default-frame-alist' | 1744 | `default-frame-alist'. If either PARAMETERS or `default-frame-alist' |
| 1746 | contains a `reverse' parameter, handle that. Value is the new frame | 1745 | contains a `reverse' parameter, handle that. Value is the new frame |
| 1747 | created." | 1746 | created." |
| 1748 | (let ((frame (make-terminal-frame `((frame-creation-function . tty-create-frame-with-faces) . | 1747 | (let ((frame (make-terminal-frame `((window-system . nil) . ,parameters))) |
| 1749 | ,parameters))) | ||
| 1750 | success) | 1748 | success) |
| 1751 | (unwind-protect | 1749 | (unwind-protect |
| 1752 | (progn | 1750 | (progn |
diff --git a/lisp/frame.el b/lisp/frame.el index f5c1e645ff3..2175bdd8615 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -27,12 +27,17 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (defvar frame-creation-function nil | 30 | (defvar frame-creation-function-alist |
| 31 | "Window-system dependent function to call to create a new frame. | 31 | (list (cons nil |
| 32 | The window system startup file should set this to its frame creation | 32 | (if (fboundp 'tty-create-frame-with-faces) |
| 33 | function, which should take an alist of parameters as its argument.") | 33 | 'tty-create-frame-with-faces |
| 34 | 34 | (function | |
| 35 | (make-variable-frame-local 'frame-creation-function) | 35 | (lambda (parameters) |
| 36 | (error "Can't create multiple frames without a window system")))))) | ||
| 37 | "Alist of window-system dependent functions to call to create a new frame. | ||
| 38 | The window system startup file should add its frame creation | ||
| 39 | function to this list, which should take an alist of parameters | ||
| 40 | as its argument.") | ||
| 36 | 41 | ||
| 37 | ;; The initial value given here used to ask for a minibuffer. | 42 | ;; The initial value given here used to ask for a minibuffer. |
| 38 | ;; But that's not necessary, because the default is to have one. | 43 | ;; 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." | |||
| 188 | (defun frame-initialize () | 193 | (defun frame-initialize () |
| 189 | "Create an initial frame if necessary." | 194 | "Create an initial frame if necessary." |
| 190 | ;; Are we actually running under a window system at all? | 195 | ;; Are we actually running under a window system at all? |
| 191 | (if (and window-system (not noninteractive) (not (eq window-system 'pc))) | 196 | (if (and initial-window-system |
| 197 | (not noninteractive) | ||
| 198 | (not (eq initial-window-system 'pc))) | ||
| 192 | (progn | 199 | (progn |
| 193 | ;; Turn on special-display processing only if there's a window system. | 200 | ;; Turn on special-display processing only if there's a window system. |
| 194 | (setq special-display-function 'special-display-popup-frame) | 201 | (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." | |||
| 205 | (setq frame-initial-frame-alist | 212 | (setq frame-initial-frame-alist |
| 206 | (cons '(horizontal-scroll-bars . t) | 213 | (cons '(horizontal-scroll-bars . t) |
| 207 | frame-initial-frame-alist))) | 214 | frame-initial-frame-alist))) |
| 215 | (setq frame-initial-frame-alist | ||
| 216 | (cons (cons 'window-system initial-window-system) | ||
| 217 | frame-initial-frame-alist)) | ||
| 208 | (setq default-minibuffer-frame | 218 | (setq default-minibuffer-frame |
| 209 | (setq frame-initial-frame | 219 | (setq frame-initial-frame |
| 210 | (make-frame frame-initial-frame-alist))) | 220 | (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." | |||
| 217 | ;; At this point, we know that we have a frame open, so we | 227 | ;; At this point, we know that we have a frame open, so we |
| 218 | ;; can delete the terminal frame. | 228 | ;; can delete the terminal frame. |
| 219 | (delete-frame terminal-frame) | 229 | (delete-frame terminal-frame) |
| 220 | (setq terminal-frame nil)) | 230 | (setq terminal-frame nil)))) |
| 221 | |||
| 222 | ;; No, we're not running a window system. Use make-terminal-frame if | ||
| 223 | ;; we support that feature, otherwise arrange to cause errors. | ||
| 224 | (or (eq window-system 'pc) | ||
| 225 | (setq frame-creation-function | ||
| 226 | (if (fboundp 'tty-create-frame-with-faces) | ||
| 227 | 'tty-create-frame-with-faces | ||
| 228 | (function | ||
| 229 | (lambda (parameters) | ||
| 230 | (error | ||
| 231 | "Can't create multiple frames without a window system")))))))) | ||
| 232 | 231 | ||
| 233 | (defvar frame-notice-user-settings t | 232 | (defvar frame-notice-user-settings t |
| 234 | "Non-nil means function `frame-notice-user-settings' wasn't run yet.") | 233 | "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." | |||
| 278 | ;; Can't modify the minibuffer parameter, so don't try. | 277 | ;; Can't modify the minibuffer parameter, so don't try. |
| 279 | (setq parms (delq (assq 'minibuffer parms) parms)) | 278 | (setq parms (delq (assq 'minibuffer parms) parms)) |
| 280 | (modify-frame-parameters nil | 279 | (modify-frame-parameters nil |
| 281 | (if (null window-system) | 280 | (if (null initial-window-system) |
| 282 | (append initial-frame-alist | 281 | (append initial-frame-alist |
| 283 | default-frame-alist | 282 | default-frame-alist |
| 284 | parms | 283 | parms |
| @@ -287,7 +286,7 @@ React to settings of `default-frame-alist', `initial-frame-alist' there." | |||
| 287 | ;; default-frame-alist were already | 286 | ;; default-frame-alist were already |
| 288 | ;; applied in pc-win.el. | 287 | ;; applied in pc-win.el. |
| 289 | parms)) | 288 | parms)) |
| 290 | (if (null window-system) ;; MS-DOS does this differently in pc-win.el | 289 | (if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el |
| 291 | (let ((newparms (frame-parameters)) | 290 | (let ((newparms (frame-parameters)) |
| 292 | (frame (selected-frame))) | 291 | (frame (selected-frame))) |
| 293 | (tty-handle-reverse-video frame newparms) | 292 | (tty-handle-reverse-video frame newparms) |
| @@ -571,26 +570,18 @@ The optional second argument PARAMETERS specifies additional frame parameters." | |||
| 571 | (interactive "sMake frame on display: ") | 570 | (interactive "sMake frame on display: ") |
| 572 | (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display) | 571 | (or (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" display) |
| 573 | (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN")) | 572 | (error "Invalid display, not HOST:SERVER or HOST:SERVER.SCREEN")) |
| 574 | (make-frame (cons (cons 'display display) parameters))) | 573 | (load (concat term-file-prefix "x-win")) |
| 574 | (make-frame `((window-system . x) (display . ,display) . ,parameters))) | ||
| 575 | 575 | ||
| 576 | ;;;###autoload | ||
| 577 | (defun make-frame-on-tty (device type &optional parameters) | 576 | (defun make-frame-on-tty (device type &optional parameters) |
| 578 | "Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\"). | 577 | "Make a frame on terminal DEVICE which is of type TYPE (e.g., \"xterm\"). |
| 579 | The optional third argument PARAMETERS specifies additional frame parameters. | 578 | The optional third argument PARAMETERS specifies additional frame parameters." |
| 580 | |||
| 581 | DEVICE must be a proxy psudo terminal created by emacsclient, | ||
| 582 | otherwise there will be problems with terminal input and window | ||
| 583 | resizes. (The kernel notifies processes about pending input or | ||
| 584 | terminal resizes only on the controlling terminal, so we need | ||
| 585 | emacsclient to sit on the real terminal device, create SIGIO | ||
| 586 | signals upon terminal input, and forward SIGWINCH signals to | ||
| 587 | us.)" | ||
| 588 | (interactive "fOpen frame on tty device: \nsTerminal type of %s: ") | 579 | (interactive "fOpen frame on tty device: \nsTerminal type of %s: ") |
| 589 | (unless device | 580 | (unless device |
| 590 | (error "Invalid terminal device")) | 581 | (error "Invalid terminal device")) |
| 591 | (unless type | 582 | (unless type |
| 592 | (error "Invalid terminal type")) | 583 | (error "Invalid terminal type")) |
| 593 | (tty-create-frame-with-faces (append (list (cons 'tty device) (cons 'tty-type type)) parameters))) | 584 | (make-frame `((window-system . nil) (tty . ,device) (tty-type . ,type) . ,parameters))) |
| 594 | 585 | ||
| 595 | (defun make-frame-command () | 586 | (defun make-frame-command () |
| 596 | "Make a new frame, and select it if the terminal displays only one frame." | 587 | "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. | |||
| 630 | (minibuffer . only) The frame should contain only a minibuffer. | 621 | (minibuffer . only) The frame should contain only a minibuffer. |
| 631 | (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window. | 622 | (minibuffer . WINDOW) The frame should use WINDOW as its minibuffer window. |
| 632 | 623 | ||
| 633 | Before the frame is created (via `frame-creation-function'), functions on the | 624 | (window-system . nil) The frame should be displayed on a terminal device. |
| 625 | (window-system . x) The frame should be displayed in an X window. | ||
| 626 | |||
| 627 | Before the frame is created (via `frame-creation-function-alist'), functions on the | ||
| 634 | hook `before-make-frame-hook' are run. After the frame is created, functions | 628 | hook `before-make-frame-hook' are run. After the frame is created, functions |
| 635 | on `after-make-frame-functions' are run with one arg, the newly created frame." | 629 | on `after-make-frame-functions' are run with one arg, the newly created frame." |
| 636 | (interactive) | 630 | (interactive) |
| 637 | (run-hooks 'before-make-frame-hook) | 631 | (let* ((w (if (assq 'window-system parameters) |
| 638 | (let ((frame (funcall frame-creation-function parameters))) | 632 | (cdr (assq 'window-system parameters)) |
| 633 | window-system)) | ||
| 634 | (frame-creation-function (cdr (assq w frame-creation-function-alist))) | ||
| 635 | frame) | ||
| 636 | (unless frame-creation-function | ||
| 637 | (error "Don't know how to create a frame on window system %s" w)) | ||
| 638 | (run-hooks 'before-make-frame-hook) | ||
| 639 | (funcall frame-creation-function parameters) | ||
| 639 | (run-hook-with-args 'after-make-frame-functions frame) | 640 | (run-hook-with-args 'after-make-frame-functions frame) |
| 640 | frame)) | 641 | frame)) |
| 641 | 642 | ||
| @@ -780,9 +781,9 @@ If there is no frame by that name, signal an error." | |||
| 780 | (raise-frame frame) | 781 | (raise-frame frame) |
| 781 | (select-frame frame) | 782 | (select-frame frame) |
| 782 | ;; Ensure, if possible, that frame gets input focus. | 783 | ;; Ensure, if possible, that frame gets input focus. |
| 783 | (cond ((eq window-system 'x) | 784 | (cond ((eq (window-system frame) 'x) |
| 784 | (x-focus-frame frame)) | 785 | (x-focus-frame frame)) |
| 785 | ((eq window-system 'w32) | 786 | ((eq (window-system frame) 'w32) |
| 786 | (w32-focus-frame frame))) | 787 | (w32-focus-frame frame))) |
| 787 | (when focus-follows-mouse | 788 | (when focus-follows-mouse |
| 788 | (set-mouse-position frame (1- (frame-width frame)) 0)))) | 789 | (set-mouse-position frame (1- (frame-width frame)) 0)))) |
diff --git a/lisp/loadup.el b/lisp/loadup.el index bd90fb7c53a..26f7b34108a 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -67,6 +67,8 @@ | |||
| 67 | (setq load-source-file-function 'load-with-code-conversion) | 67 | (setq load-source-file-function 'load-with-code-conversion) |
| 68 | (load "files") | 68 | (load "files") |
| 69 | 69 | ||
| 70 | (load "startup") | ||
| 71 | |||
| 70 | (load "cus-face") | 72 | (load "cus-face") |
| 71 | (load "faces") ; after here, `defface' may be used. | 73 | (load "faces") ; after here, `defface' may be used. |
| 72 | 74 | ||
| @@ -146,7 +148,6 @@ | |||
| 146 | (message "%s" (garbage-collect)) | 148 | (message "%s" (garbage-collect)) |
| 147 | (load "menu-bar") | 149 | (load "menu-bar") |
| 148 | (load "paths.el") ;Don't get confused if someone compiled paths by mistake. | 150 | (load "paths.el") ;Don't get confused if someone compiled paths by mistake. |
| 149 | (load "startup") | ||
| 150 | (load "emacs-lisp/lisp") | 151 | (load "emacs-lisp/lisp") |
| 151 | (load "textmodes/page") | 152 | (load "textmodes/page") |
| 152 | (load "register") | 153 | (load "register") |
diff --git a/lisp/startup.el b/lisp/startup.el index 2808689eaeb..969daf49777 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -128,6 +128,13 @@ | |||
| 128 | (defvar command-line-processed nil | 128 | (defvar command-line-processed nil |
| 129 | "Non-nil once command line has been processed.") | 129 | "Non-nil once command line has been processed.") |
| 130 | 130 | ||
| 131 | (defvar window-system initial-window-system | ||
| 132 | "Name of window system the selected frame is displaying through. | ||
| 133 | The value is a symbol--for instance, `x' for X windows. | ||
| 134 | The value is nil if the selected frame is on a text-only-terminal.") | ||
| 135 | |||
| 136 | (make-variable-frame-local 'window-system) | ||
| 137 | |||
| 131 | (defgroup initialization nil | 138 | (defgroup initialization nil |
| 132 | "Emacs start-up procedure" | 139 | "Emacs start-up procedure" |
| 133 | :group 'internal) | 140 | :group 'internal) |
| @@ -512,9 +519,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 512 | ;; for instance due to a dense colormap. | 519 | ;; for instance due to a dense colormap. |
| 513 | (when (or frame-initial-frame | 520 | (when (or frame-initial-frame |
| 514 | ;; If frame-initial-frame has no meaning, do this anyway. | 521 | ;; If frame-initial-frame has no meaning, do this anyway. |
| 515 | (not (and window-system | 522 | (not (and initial-window-system |
| 516 | (not noninteractive) | 523 | (not noninteractive) |
| 517 | (not (eq window-system 'pc))))) | 524 | (not (eq initial-window-system 'pc))))) |
| 518 | ;; Modify the initial frame based on what .emacs puts into | 525 | ;; Modify the initial frame based on what .emacs puts into |
| 519 | ;; ...-frame-alist. | 526 | ;; ...-frame-alist. |
| 520 | (if (fboundp 'frame-notice-user-settings) | 527 | (if (fboundp 'frame-notice-user-settings) |
| @@ -527,7 +534,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 527 | (let ((frame-background-mode frame-background-mode) | 534 | (let ((frame-background-mode frame-background-mode) |
| 528 | (frame (selected-frame)) | 535 | (frame (selected-frame)) |
| 529 | term) | 536 | term) |
| 530 | (when (and (null window-system) | 537 | (when (and (null initial-window-system) |
| 531 | ;; Don't override a possibly customized value. | 538 | ;; Don't override a possibly customized value. |
| 532 | (null frame-background-mode) | 539 | (null frame-background-mode) |
| 533 | ;; Don't override user specifications. | 540 | ;; Don't override user specifications. |
| @@ -702,9 +709,9 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 702 | 709 | ||
| 703 | ;; Read window system's init file if using a window system. | 710 | ;; Read window system's init file if using a window system. |
| 704 | (condition-case error | 711 | (condition-case error |
| 705 | (if (and window-system (not noninteractive)) | 712 | (if (and initial-window-system (not noninteractive)) |
| 706 | (load (concat term-file-prefix | 713 | (load (concat term-file-prefix |
| 707 | (symbol-name window-system) | 714 | (symbol-name initial-window-system) |
| 708 | "-win") | 715 | "-win") |
| 709 | ;; Every window system should have a startup file; | 716 | ;; Every window system should have a startup file; |
| 710 | ;; barf if we can't find it. | 717 | ;; barf if we can't find it. |
| @@ -725,7 +732,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 725 | (cdr error) ", ")))) | 732 | (cdr error) ", ")))) |
| 726 | 'external-debugging-output) | 733 | 'external-debugging-output) |
| 727 | (terpri 'external-debugging-output) | 734 | (terpri 'external-debugging-output) |
| 728 | (setq window-system nil) | 735 | (setq initial-window-system nil) |
| 729 | (kill-emacs))) | 736 | (kill-emacs))) |
| 730 | 737 | ||
| 731 | ;; Windowed displays do this inside their *-win.el. | 738 | ;; Windowed displays do this inside their *-win.el. |
| @@ -808,7 +815,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 808 | 815 | ||
| 809 | ;; If frame was created with a menu bar, set menu-bar-mode on. | 816 | ;; If frame was created with a menu bar, set menu-bar-mode on. |
| 810 | (unless (or noninteractive | 817 | (unless (or noninteractive |
| 811 | (and (memq window-system '(x w32)) | 818 | (and (memq initial-window-system '(x w32)) |
| 812 | (<= (frame-parameter nil 'menu-bar-lines) 0))) | 819 | (<= (frame-parameter nil 'menu-bar-lines) 0))) |
| 813 | (menu-bar-mode 1)) | 820 | (menu-bar-mode 1)) |
| 814 | 821 | ||
| @@ -818,10 +825,10 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 818 | (<= (frame-parameter nil 'tool-bar-lines) 0)) | 825 | (<= (frame-parameter nil 'tool-bar-lines) 0)) |
| 819 | (tool-bar-mode 1)) | 826 | (tool-bar-mode 1)) |
| 820 | 827 | ||
| 821 | ;; Can't do this init in defcustom because window-system isn't set. | 828 | ;; Can't do this init in defcustom because initial-window-system isn't set. |
| 822 | (unless (or noninteractive | 829 | (unless (or noninteractive |
| 823 | (eq system-type 'ms-dos) | 830 | (eq system-type 'ms-dos) |
| 824 | (not (memq window-system '(x w32)))) | 831 | (not (memq initial-window-system '(x w32)))) |
| 825 | (setq-default blink-cursor t) | 832 | (setq-default blink-cursor t) |
| 826 | (blink-cursor-mode 1)) | 833 | (blink-cursor-mode 1)) |
| 827 | 834 | ||
| @@ -829,13 +836,13 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 829 | ;; DOS/Windows systems have a PC-type keyboard which has both | 836 | ;; DOS/Windows systems have a PC-type keyboard which has both |
| 830 | ;; <delete> and <backspace> keys. | 837 | ;; <delete> and <backspace> keys. |
| 831 | (when (or (memq system-type '(ms-dos windows-nt)) | 838 | (when (or (memq system-type '(ms-dos windows-nt)) |
| 832 | (and (memq window-system '(x)) | 839 | (and (memq initial-window-system '(x)) |
| 833 | (fboundp 'x-backspace-delete-keys-p) | 840 | (fboundp 'x-backspace-delete-keys-p) |
| 834 | (x-backspace-delete-keys-p)) | 841 | (x-backspace-delete-keys-p)) |
| 835 | ;; If the terminal Emacs is running on has erase char | 842 | ;; If the terminal Emacs is running on has erase char |
| 836 | ;; set to ^H, use the Backspace key for deleting | 843 | ;; set to ^H, use the Backspace key for deleting |
| 837 | ;; backward and, and the Delete key for deleting forward. | 844 | ;; backward and, and the Delete key for deleting forward. |
| 838 | (and (null window-system) | 845 | (and (null initial-window-system) |
| 839 | (eq tty-erase-char 8))) | 846 | (eq tty-erase-char 8))) |
| 840 | (setq-default normal-erase-is-backspace t) | 847 | (setq-default normal-erase-is-backspace t) |
| 841 | (normal-erase-is-backspace-mode 1))) | 848 | (normal-erase-is-backspace-mode 1))) |
| @@ -848,7 +855,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 848 | 855 | ||
| 849 | ;; Register default TTY colors for the case the terminal hasn't a | 856 | ;; Register default TTY colors for the case the terminal hasn't a |
| 850 | ;; terminal init file. | 857 | ;; terminal init file. |
| 851 | (unless (memq window-system '(x w32)) | 858 | (unless (memq initial-window-system '(x w32)) |
| 852 | ;; We do this regardles of whether the terminal supports colors | 859 | ;; We do this regardles of whether the terminal supports colors |
| 853 | ;; or not, since they can switch that support on or off in | 860 | ;; or not, since they can switch that support on or off in |
| 854 | ;; mid-session by setting the tty-color-mode frame parameter. | 861 | ;; 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'." | |||
| 1046 | ;; Load library for our terminal type. | 1053 | ;; Load library for our terminal type. |
| 1047 | ;; User init file can set term-file-prefix to nil to prevent this. | 1054 | ;; User init file can set term-file-prefix to nil to prevent this. |
| 1048 | (unless (or noninteractive | 1055 | (unless (or noninteractive |
| 1049 | window-system | 1056 | initial-window-system |
| 1050 | (null term-file-prefix)) | 1057 | (null term-file-prefix)) |
| 1051 | (let ((term (getenv "TERM")) | 1058 | (let ((term (getenv "TERM")) |
| 1052 | hyphend) | 1059 | hyphend) |
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 2388b7e29bd..11e3c073b76 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el | |||
| @@ -66,7 +66,7 @@ | |||
| 66 | ;; An alist of X options and the function which handles them. See | 66 | ;; An alist of X options and the function which handles them. See |
| 67 | ;; ../startup.el. | 67 | ;; ../startup.el. |
| 68 | 68 | ||
| 69 | (if (not (eq window-system 'x)) | 69 | (if (not (fboundp 'x-create-frame)) |
| 70 | (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) | 70 | (error "%s: Loading x-win.el but not compiled for X" (invocation-name))) |
| 71 | 71 | ||
| 72 | (require 'frame) | 72 | (require 'frame) |
| @@ -1159,6 +1159,7 @@ XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") | |||
| 1159 | 1159 | ||
| 1160 | ;;;; Function keys | 1160 | ;;;; Function keys |
| 1161 | 1161 | ||
| 1162 | ;;; XXX This might be wrong with multi-tty support. | ||
| 1162 | (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame | 1163 | (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame |
| 1163 | global-map) | 1164 | global-map) |
| 1164 | 1165 | ||
| @@ -2346,10 +2347,11 @@ order until succeed.") | |||
| 2346 | (x-open-connection (or x-display-name | 2347 | (x-open-connection (or x-display-name |
| 2347 | (setq x-display-name (getenv "DISPLAY"))) | 2348 | (setq x-display-name (getenv "DISPLAY"))) |
| 2348 | x-command-line-resources | 2349 | x-command-line-resources |
| 2349 | ;; Exit Emacs with fatal error if this fails. | 2350 | ;; Exit Emacs with fatal error if this fails and we |
| 2350 | t) | 2351 | ;; are the initial display. |
| 2352 | (eq initial-window-system 'x)) | ||
| 2351 | 2353 | ||
| 2352 | (setq frame-creation-function 'x-create-frame-with-faces) | 2354 | (add-to-list 'frame-creation-function-alist '(x . x-create-frame-with-faces)) |
| 2353 | 2355 | ||
| 2354 | (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) | 2356 | (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) |
| 2355 | x-cut-buffer-max)) | 2357 | x-cut-buffer-max)) |
| @@ -2431,6 +2433,7 @@ order until succeed.") | |||
| 2431 | (if res-selection-timeout | 2433 | (if res-selection-timeout |
| 2432 | (setq x-selection-timeout (string-to-number res-selection-timeout)))) | 2434 | (setq x-selection-timeout (string-to-number res-selection-timeout)))) |
| 2433 | 2435 | ||
| 2436 | ;; XXX This is wrong with multi-tty support. | ||
| 2434 | (defun x-win-suspend-error () | 2437 | (defun x-win-suspend-error () |
| 2435 | (error "Suspending an Emacs running under X makes no sense")) | 2438 | (error "Suspending an Emacs running under X makes no sense")) |
| 2436 | (add-hook 'suspend-hook 'x-win-suspend-error) | 2439 | (add-hook 'suspend-hook 'x-win-suspend-error) |
| @@ -2453,5 +2456,7 @@ order until succeed.") | |||
| 2453 | ;; Turn on support for mouse wheels. | 2456 | ;; Turn on support for mouse wheels. |
| 2454 | (mouse-wheel-mode 1) | 2457 | (mouse-wheel-mode 1) |
| 2455 | 2458 | ||
| 2459 | (provide 'x-win) | ||
| 2460 | |||
| 2456 | ;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 | 2461 | ;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 |
| 2457 | ;;; x-win.el ends here | 2462 | ;;; x-win.el ends here |
diff --git a/src/dispnew.c b/src/dispnew.c index a3d77809c6f..81a0f1f5c8e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -214,9 +214,9 @@ int inverse_video; | |||
| 214 | EMACS_INT baud_rate; | 214 | EMACS_INT baud_rate; |
| 215 | 215 | ||
| 216 | /* Either nil or a symbol naming the window system under which Emacs | 216 | /* Either nil or a symbol naming the window system under which Emacs |
| 217 | is running. */ | 217 | creates the first frame. */ |
| 218 | 218 | ||
| 219 | Lisp_Object Vwindow_system; | 219 | Lisp_Object Vinitial_window_system; |
| 220 | 220 | ||
| 221 | /* Version number of X windows: 10, 11 or nil. */ | 221 | /* Version number of X windows: 10, 11 or nil. */ |
| 222 | 222 | ||
| @@ -6569,7 +6569,7 @@ init_display () | |||
| 6569 | 6569 | ||
| 6570 | /* Now is the time to initialize this; it's used by init_sys_modes | 6570 | /* Now is the time to initialize this; it's used by init_sys_modes |
| 6571 | during startup. */ | 6571 | during startup. */ |
| 6572 | Vwindow_system = Qnil; | 6572 | Vinitial_window_system = Qnil; |
| 6573 | 6573 | ||
| 6574 | /* If the user wants to use a window system, we shouldn't bother | 6574 | /* If the user wants to use a window system, we shouldn't bother |
| 6575 | initializing the terminal. This is especially important when the | 6575 | initializing the terminal. This is especially important when the |
| @@ -6598,7 +6598,7 @@ init_display () | |||
| 6598 | #endif | 6598 | #endif |
| 6599 | ) | 6599 | ) |
| 6600 | { | 6600 | { |
| 6601 | Vwindow_system = intern ("x"); | 6601 | Vinitial_window_system = intern ("x"); |
| 6602 | #ifdef HAVE_X11 | 6602 | #ifdef HAVE_X11 |
| 6603 | Vwindow_system_version = make_number (11); | 6603 | Vwindow_system_version = make_number (11); |
| 6604 | #else | 6604 | #else |
| @@ -6618,7 +6618,7 @@ init_display () | |||
| 6618 | #ifdef HAVE_NTGUI | 6618 | #ifdef HAVE_NTGUI |
| 6619 | if (!inhibit_window_system) | 6619 | if (!inhibit_window_system) |
| 6620 | { | 6620 | { |
| 6621 | Vwindow_system = intern ("w32"); | 6621 | Vinitial_window_system = intern ("w32"); |
| 6622 | Vwindow_system_version = make_number (1); | 6622 | Vwindow_system_version = make_number (1); |
| 6623 | adjust_frame_glyphs_initially (); | 6623 | adjust_frame_glyphs_initially (); |
| 6624 | return; | 6624 | return; |
| @@ -6628,7 +6628,7 @@ init_display () | |||
| 6628 | #ifdef MAC_OS | 6628 | #ifdef MAC_OS |
| 6629 | if (!inhibit_window_system) | 6629 | if (!inhibit_window_system) |
| 6630 | { | 6630 | { |
| 6631 | Vwindow_system = intern ("mac"); | 6631 | Vinitial_window_system = intern ("mac"); |
| 6632 | Vwindow_system_version = make_number (1); | 6632 | Vwindow_system_version = make_number (1); |
| 6633 | adjust_frame_glyphs_initially (); | 6633 | adjust_frame_glyphs_initially (); |
| 6634 | return; | 6634 | return; |
| @@ -6730,7 +6730,7 @@ For types not defined in VMS, use define emacs_term \"TYPE\".\n\ | |||
| 6730 | and internal_terminal_init. */ | 6730 | and internal_terminal_init. */ |
| 6731 | && (strcmp (terminal_type, "internal") != 0 || inhibit_window_system) | 6731 | && (strcmp (terminal_type, "internal") != 0 || inhibit_window_system) |
| 6732 | #endif | 6732 | #endif |
| 6733 | && NILP (Vwindow_system)) | 6733 | && NILP (Vinitial_window_system)) |
| 6734 | { | 6734 | { |
| 6735 | /* For the initial frame, we don't have any way of knowing what | 6735 | /* For the initial frame, we don't have any way of knowing what |
| 6736 | are the foreground and background colors of the terminal. */ | 6736 | 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 | |||
| 6842 | Emacs's frame display when you reenter Emacs. | 6842 | Emacs's frame display when you reenter Emacs. |
| 6843 | It is up to you to set this variable if your terminal can do that. */); | 6843 | It is up to you to set this variable if your terminal can do that. */); |
| 6844 | 6844 | ||
| 6845 | DEFVAR_LISP ("window-system", &Vwindow_system, | 6845 | DEFVAR_LISP ("initial-window-system", &Vinitial_window_system, |
| 6846 | doc: /* Name of window system that Emacs is displaying through. | 6846 | doc: /* Name of the window system that Emacs uses for the first frame. |
| 6847 | The value is a symbol--for instance, `x' for X windows. | 6847 | The value is a symbol--for instance, `x' for X windows. |
| 6848 | The value is nil if Emacs is using a text-only terminal. */); | 6848 | The value is nil if Emacs is using a text-only terminal. */); |
| 6849 | 6849 | ||
| @@ -6879,7 +6879,7 @@ See `buffer-display-table' for more information. */); | |||
| 6879 | if (noninteractive) | 6879 | if (noninteractive) |
| 6880 | #endif | 6880 | #endif |
| 6881 | { | 6881 | { |
| 6882 | Vwindow_system = Qnil; | 6882 | Vinitial_window_system = Qnil; |
| 6883 | Vwindow_system_version = Qnil; | 6883 | Vwindow_system_version = Qnil; |
| 6884 | } | 6884 | } |
| 6885 | } | 6885 | } |
diff --git a/src/emacs.c b/src/emacs.c index 25a421cb30e..4f66e4bdb07 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -192,7 +192,7 @@ int display_arg; | |||
| 192 | char *stack_bottom; | 192 | char *stack_bottom; |
| 193 | 193 | ||
| 194 | #ifdef HAVE_WINDOW_SYSTEM | 194 | #ifdef HAVE_WINDOW_SYSTEM |
| 195 | extern Lisp_Object Vwindow_system; | 195 | extern Lisp_Object Vinitial_window_system; |
| 196 | #endif /* HAVE_WINDOW_SYSTEM */ | 196 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 197 | 197 | ||
| 198 | extern Lisp_Object Vauto_save_list_file_name; | 198 | extern Lisp_Object Vauto_save_list_file_name; |
| @@ -2017,9 +2017,9 @@ shut_down_emacs (sig, no_x, stuff) | |||
| 2017 | #if 0 /* This triggers a bug in XCloseDisplay and is not needed. */ | 2017 | #if 0 /* This triggers a bug in XCloseDisplay and is not needed. */ |
| 2018 | #ifdef HAVE_X_WINDOWS | 2018 | #ifdef HAVE_X_WINDOWS |
| 2019 | /* It's not safe to call intern here. Maybe we are crashing. */ | 2019 | /* It's not safe to call intern here. Maybe we are crashing. */ |
| 2020 | if (!noninteractive && SYMBOLP (Vwindow_system) | 2020 | if (!noninteractive && SYMBOLP (Vinitial_window_system) |
| 2021 | && SCHARS (SYMBOL_NAME (Vwindow_system)) == 1 | 2021 | && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1 |
| 2022 | && SREF (SYMBOL_NAME (Vwindow_system), 0) == 'x' | 2022 | && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x' |
| 2023 | && ! no_x) | 2023 | && ! no_x) |
| 2024 | Fx_close_current_connection (); | 2024 | Fx_close_current_connection (); |
| 2025 | #endif /* HAVE_X_WINDOWS */ | 2025 | #endif /* HAVE_X_WINDOWS */ |
diff --git a/src/keyboard.c b/src/keyboard.c index 4f262678acf..1897fb5c0f8 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10503,8 +10503,7 @@ See also `current-input-mode'. */) | |||
| 10503 | 10503 | ||
| 10504 | #ifndef DOS_NT | 10504 | #ifndef DOS_NT |
| 10505 | /* this causes startup screen to be restored and messes with the mouse */ | 10505 | /* this causes startup screen to be restored and messes with the mouse */ |
| 10506 | if (FRAME_TERMCAP_P (SELECTED_FRAME ())) | 10506 | reset_all_sys_modes (); |
| 10507 | reset_sys_modes (CURTTY ()); | ||
| 10508 | #endif | 10507 | #endif |
| 10509 | 10508 | ||
| 10510 | #ifdef SIGIO | 10509 | #ifdef SIGIO |
| @@ -10542,13 +10541,12 @@ See also `current-input-mode'. */) | |||
| 10542 | tty->meta_key = 2; | 10541 | tty->meta_key = 2; |
| 10543 | } | 10542 | } |
| 10544 | 10543 | ||
| 10545 | if (FRAME_TERMCAP_P (XFRAME (selected_frame)) && !NILP (quit)) | 10544 | if (!NILP (quit)) |
| 10546 | /* Don't let this value be out of range. */ | 10545 | /* Don't let this value be out of range. */ |
| 10547 | quit_char = XINT (quit) & (CURTTY ()->meta_key ? 0377 : 0177); | 10546 | quit_char = XINT (quit) & (NILP (meta) ? 0177 : 0377); |
| 10548 | 10547 | ||
| 10549 | #ifndef DOS_NT | 10548 | #ifndef DOS_NT |
| 10550 | if (FRAME_TERMCAP_P (XFRAME (selected_frame)) && CURTTY ()->type) | 10549 | init_all_sys_modes (); |
| 10551 | init_sys_modes (CURTTY ()); | ||
| 10552 | #endif | 10550 | #endif |
| 10553 | 10551 | ||
| 10554 | #ifdef POLL_FOR_INPUT | 10552 | #ifdef POLL_FOR_INPUT |
diff --git a/src/sysdep.c b/src/sysdep.c index 5a2bb449df1..d57fe146fc0 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -1394,267 +1394,261 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1394 | #if 0 | 1394 | #if 0 |
| 1395 | /* read_socket_hook is not global anymore. I think doing this | 1395 | /* read_socket_hook is not global anymore. I think doing this |
| 1396 | unconditionally will not cause any problems. */ | 1396 | unconditionally will not cause any problems. */ |
| 1397 | if (! read_socket_hook && EQ (Vwindow_system, Qnil)) | 1397 | if (! read_socket_hook && EQ (Vinitial_window_system, Qnil)) |
| 1398 | #endif | 1398 | #endif |
| 1399 | narrow_foreground_group (fileno (TTY_INPUT (tty_out))); | 1399 | narrow_foreground_group (fileno (TTY_INPUT (tty_out))); |
| 1400 | #endif | 1400 | #endif |
| 1401 | 1401 | ||
| 1402 | #ifdef HAVE_WINDOW_SYSTEM | 1402 | if (! tty_out->old_tty) |
| 1403 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | 1403 | tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); |
| 1404 | needs the initialization code below. */ | ||
| 1405 | if (tty_out->input != stdin || EQ (Vwindow_system, Qnil)) | ||
| 1406 | #endif | ||
| 1407 | { | ||
| 1408 | if (! tty_out->old_tty) | ||
| 1409 | tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty)); | ||
| 1410 | 1404 | ||
| 1411 | EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), tty_out->old_tty); | 1405 | EMACS_GET_TTY (fileno (TTY_INPUT (tty_out)), tty_out->old_tty); |
| 1412 | 1406 | ||
| 1413 | tty = *tty_out->old_tty; | 1407 | tty = *tty_out->old_tty; |
| 1414 | 1408 | ||
| 1415 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) | 1409 | #if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) |
| 1416 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); | 1410 | XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); |
| 1417 | 1411 | ||
| 1418 | #ifdef DGUX | 1412 | #ifdef DGUX |
| 1419 | /* This allows meta to be sent on 8th bit. */ | 1413 | /* This allows meta to be sent on 8th bit. */ |
| 1420 | tty.main.c_iflag &= ~INPCK; /* don't check input for parity */ | 1414 | tty.main.c_iflag &= ~INPCK; /* don't check input for parity */ |
| 1421 | #endif | 1415 | #endif |
| 1422 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ | 1416 | tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ |
| 1423 | tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */ | 1417 | tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */ |
| 1424 | #ifdef INLCR /* I'm just being cautious, | 1418 | #ifdef INLCR /* I'm just being cautious, |
| 1425 | since I can't check how widespread INLCR is--rms. */ | 1419 | since I can't check how widespread INLCR is--rms. */ |
| 1426 | tty.main.c_iflag &= ~INLCR; /* Disable map of NL to CR on input */ | 1420 | tty.main.c_iflag &= ~INLCR; /* Disable map of NL to CR on input */ |
| 1427 | #endif | 1421 | #endif |
| 1428 | #ifdef ISTRIP | 1422 | #ifdef ISTRIP |
| 1429 | tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */ | 1423 | tty.main.c_iflag &= ~ISTRIP; /* don't strip 8th bit on input */ |
| 1430 | #endif | 1424 | #endif |
| 1431 | tty.main.c_lflag &= ~ECHO; /* Disable echo */ | 1425 | tty.main.c_lflag &= ~ECHO; /* Disable echo */ |
| 1432 | tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */ | 1426 | tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */ |
| 1433 | #ifdef IEXTEN | 1427 | #ifdef IEXTEN |
| 1434 | tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ | 1428 | tty.main.c_lflag &= ~IEXTEN; /* Disable other editing characters. */ |
| 1435 | #endif | 1429 | #endif |
| 1436 | tty.main.c_lflag |= ISIG; /* Enable signals */ | 1430 | tty.main.c_lflag |= ISIG; /* Enable signals */ |
| 1437 | if (tty_out->flow_control) | 1431 | if (tty_out->flow_control) |
| 1438 | { | 1432 | { |
| 1439 | tty.main.c_iflag |= IXON; /* Enable start/stop output control */ | 1433 | tty.main.c_iflag |= IXON; /* Enable start/stop output control */ |
| 1440 | #ifdef IXANY | 1434 | #ifdef IXANY |
| 1441 | tty.main.c_iflag &= ~IXANY; | 1435 | tty.main.c_iflag &= ~IXANY; |
| 1442 | #endif /* IXANY */ | 1436 | #endif /* IXANY */ |
| 1443 | } | 1437 | } |
| 1444 | else | 1438 | else |
| 1445 | tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */ | 1439 | tty.main.c_iflag &= ~IXON; /* Disable start/stop output control */ |
| 1446 | tty.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL | 1440 | tty.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL |
| 1447 | on output */ | 1441 | on output */ |
| 1448 | tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */ | 1442 | tty.main.c_oflag &= ~TAB3; /* Disable tab expansion */ |
| 1449 | #ifdef CS8 | 1443 | #ifdef CS8 |
| 1450 | if (tty_out->meta_key) | 1444 | if (tty_out->meta_key) |
| 1451 | { | 1445 | { |
| 1452 | tty.main.c_cflag |= CS8; /* allow 8th bit on input */ | 1446 | tty.main.c_cflag |= CS8; /* allow 8th bit on input */ |
| 1453 | tty.main.c_cflag &= ~PARENB;/* Don't check parity */ | 1447 | tty.main.c_cflag &= ~PARENB;/* Don't check parity */ |
| 1454 | } | 1448 | } |
| 1455 | #endif | 1449 | #endif |
| 1456 | if (tty_out->input == stdin) | 1450 | if (tty_out->input == stdin) |
| 1457 | { | 1451 | { |
| 1458 | tty.main.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ | 1452 | tty.main.c_cc[VINTR] = quit_char; /* C-g (usually) gives SIGINT */ |
| 1459 | /* Set up C-g for both SIGQUIT and SIGINT. | 1453 | /* Set up C-g for both SIGQUIT and SIGINT. |
| 1460 | We don't know which we will get, but we handle both alike | 1454 | We don't know which we will get, but we handle both alike |
| 1461 | so which one it really gives us does not matter. */ | 1455 | so which one it really gives us does not matter. */ |
| 1462 | tty.main.c_cc[VQUIT] = quit_char; | 1456 | tty.main.c_cc[VQUIT] = quit_char; |
| 1463 | } | 1457 | } |
| 1464 | else | 1458 | else |
| 1465 | { | 1459 | { |
| 1466 | /* We normally don't get interrupt or quit signals from tty | 1460 | /* We normally don't get interrupt or quit signals from tty |
| 1467 | devices other than our controlling terminal; therefore, | 1461 | devices other than our controlling terminal; therefore, |
| 1468 | we must handle C-g as normal input. Unfortunately, this | 1462 | we must handle C-g as normal input. Unfortunately, this |
| 1469 | means that the interrupt and quit feature must be | 1463 | means that the interrupt and quit feature must be |
| 1470 | disabled on secondary ttys, or we would not even see the | 1464 | disabled on secondary ttys, or we would not even see the |
| 1471 | keypress. | 1465 | keypress. |
| 1472 | 1466 | ||
| 1473 | Note that even though emacsclient could have special code | 1467 | Note that even though emacsclient could have special code |
| 1474 | to pass SIGINT to Emacs, we should _not_ enable | 1468 | to pass SIGINT to Emacs, we should _not_ enable |
| 1475 | interrupt/quit keys for emacsclient frames. This means | 1469 | interrupt/quit keys for emacsclient frames. This means |
| 1476 | that we can't break out of loops in C code from a | 1470 | that we can't break out of loops in C code from a |
| 1477 | secondary tty frame, but we can always decide what | 1471 | secondary tty frame, but we can always decide what |
| 1478 | display the C-g came from, which is more important from a | 1472 | display the C-g came from, which is more important from a |
| 1479 | usability point of view. (Consider the case when two | 1473 | usability point of view. (Consider the case when two |
| 1480 | people work together using the same Emacs instance.) */ | 1474 | people work together using the same Emacs instance.) */ |
| 1481 | tty.main.c_cc[VINTR] = CDISABLE; | 1475 | tty.main.c_cc[VINTR] = CDISABLE; |
| 1482 | tty.main.c_cc[VQUIT] = CDISABLE; | 1476 | tty.main.c_cc[VQUIT] = CDISABLE; |
| 1483 | } | 1477 | } |
| 1484 | tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ | 1478 | tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */ |
| 1485 | tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */ | 1479 | tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */ |
| 1486 | #ifdef VSWTCH | 1480 | #ifdef VSWTCH |
| 1487 | tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use | 1481 | tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use |
| 1488 | of C-z */ | 1482 | of C-z */ |
| 1489 | #endif /* VSWTCH */ | 1483 | #endif /* VSWTCH */ |
| 1490 | 1484 | ||
| 1491 | #if defined (mips) || defined (HAVE_TCATTR) | 1485 | #if defined (mips) || defined (HAVE_TCATTR) |
| 1492 | #ifdef VSUSP | 1486 | #ifdef VSUSP |
| 1493 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ | 1487 | tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ |
| 1494 | #endif /* VSUSP */ | 1488 | #endif /* VSUSP */ |
| 1495 | #ifdef V_DSUSP | 1489 | #ifdef V_DSUSP |
| 1496 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ | 1490 | tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ |
| 1497 | #endif /* V_DSUSP */ | 1491 | #endif /* V_DSUSP */ |
| 1498 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ | 1492 | #ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ |
| 1499 | tty.main.c_cc[VDSUSP] = CDISABLE; | 1493 | tty.main.c_cc[VDSUSP] = CDISABLE; |
| 1500 | #endif /* VDSUSP */ | 1494 | #endif /* VDSUSP */ |
| 1501 | #ifdef VLNEXT | 1495 | #ifdef VLNEXT |
| 1502 | tty.main.c_cc[VLNEXT] = CDISABLE; | 1496 | tty.main.c_cc[VLNEXT] = CDISABLE; |
| 1503 | #endif /* VLNEXT */ | 1497 | #endif /* VLNEXT */ |
| 1504 | #ifdef VREPRINT | 1498 | #ifdef VREPRINT |
| 1505 | tty.main.c_cc[VREPRINT] = CDISABLE; | 1499 | tty.main.c_cc[VREPRINT] = CDISABLE; |
| 1506 | #endif /* VREPRINT */ | 1500 | #endif /* VREPRINT */ |
| 1507 | #ifdef VWERASE | 1501 | #ifdef VWERASE |
| 1508 | tty.main.c_cc[VWERASE] = CDISABLE; | 1502 | tty.main.c_cc[VWERASE] = CDISABLE; |
| 1509 | #endif /* VWERASE */ | 1503 | #endif /* VWERASE */ |
| 1510 | #ifdef VDISCARD | 1504 | #ifdef VDISCARD |
| 1511 | tty.main.c_cc[VDISCARD] = CDISABLE; | 1505 | tty.main.c_cc[VDISCARD] = CDISABLE; |
| 1512 | #endif /* VDISCARD */ | 1506 | #endif /* VDISCARD */ |
| 1513 | 1507 | ||
| 1514 | if (tty_out->flow_control) | 1508 | if (tty_out->flow_control) |
| 1515 | { | 1509 | { |
| 1516 | #ifdef VSTART | 1510 | #ifdef VSTART |
| 1517 | tty.main.c_cc[VSTART] = '\021'; | 1511 | tty.main.c_cc[VSTART] = '\021'; |
| 1518 | #endif /* VSTART */ | 1512 | #endif /* VSTART */ |
| 1519 | #ifdef VSTOP | 1513 | #ifdef VSTOP |
| 1520 | tty.main.c_cc[VSTOP] = '\023'; | 1514 | tty.main.c_cc[VSTOP] = '\023'; |
| 1521 | #endif /* VSTOP */ | 1515 | #endif /* VSTOP */ |
| 1522 | } | 1516 | } |
| 1523 | else | 1517 | else |
| 1524 | { | 1518 | { |
| 1525 | #ifdef VSTART | 1519 | #ifdef VSTART |
| 1526 | tty.main.c_cc[VSTART] = CDISABLE; | 1520 | tty.main.c_cc[VSTART] = CDISABLE; |
| 1527 | #endif /* VSTART */ | 1521 | #endif /* VSTART */ |
| 1528 | #ifdef VSTOP | 1522 | #ifdef VSTOP |
| 1529 | tty.main.c_cc[VSTOP] = CDISABLE; | 1523 | tty.main.c_cc[VSTOP] = CDISABLE; |
| 1530 | #endif /* VSTOP */ | 1524 | #endif /* VSTOP */ |
| 1531 | } | 1525 | } |
| 1532 | #endif /* mips or HAVE_TCATTR */ | 1526 | #endif /* mips or HAVE_TCATTR */ |
| 1533 | 1527 | ||
| 1534 | #ifdef SET_LINE_DISCIPLINE | 1528 | #ifdef SET_LINE_DISCIPLINE |
| 1535 | /* Need to explicitly request TERMIODISC line discipline or | 1529 | /* Need to explicitly request TERMIODISC line discipline or |
| 1536 | Ultrix's termios does not work correctly. */ | 1530 | Ultrix's termios does not work correctly. */ |
| 1537 | tty.main.c_line = SET_LINE_DISCIPLINE; | 1531 | tty.main.c_line = SET_LINE_DISCIPLINE; |
| 1538 | #endif | 1532 | #endif |
| 1539 | #ifdef AIX | 1533 | #ifdef AIX |
| 1540 | #ifndef IBMR2AIX | 1534 | #ifndef IBMR2AIX |
| 1541 | /* AIX enhanced edit loses NULs, so disable it. */ | 1535 | /* AIX enhanced edit loses NULs, so disable it. */ |
| 1542 | tty.main.c_line = 0; | 1536 | tty.main.c_line = 0; |
| 1543 | tty.main.c_iflag &= ~ASCEDIT; | 1537 | tty.main.c_iflag &= ~ASCEDIT; |
| 1544 | #else | 1538 | #else |
| 1545 | tty.main.c_cc[VSTRT] = 255; | 1539 | tty.main.c_cc[VSTRT] = 255; |
| 1546 | tty.main.c_cc[VSTOP] = 255; | 1540 | tty.main.c_cc[VSTOP] = 255; |
| 1547 | tty.main.c_cc[VSUSP] = 255; | 1541 | tty.main.c_cc[VSUSP] = 255; |
| 1548 | tty.main.c_cc[VDSUSP] = 255; | 1542 | tty.main.c_cc[VDSUSP] = 255; |
| 1549 | #endif /* IBMR2AIX */ | 1543 | #endif /* IBMR2AIX */ |
| 1550 | if (tty_out->flow_control) | 1544 | if (tty_out->flow_control) |
| 1551 | { | 1545 | { |
| 1552 | #ifdef VSTART | 1546 | #ifdef VSTART |
| 1553 | tty.main.c_cc[VSTART] = '\021'; | 1547 | tty.main.c_cc[VSTART] = '\021'; |
| 1554 | #endif /* VSTART */ | 1548 | #endif /* VSTART */ |
| 1555 | #ifdef VSTOP | 1549 | #ifdef VSTOP |
| 1556 | tty.main.c_cc[VSTOP] = '\023'; | 1550 | tty.main.c_cc[VSTOP] = '\023'; |
| 1557 | #endif /* VSTOP */ | 1551 | #endif /* VSTOP */ |
| 1558 | } | 1552 | } |
| 1559 | /* Also, PTY overloads NUL and BREAK. | 1553 | /* Also, PTY overloads NUL and BREAK. |
| 1560 | don't ignore break, but don't signal either, so it looks like NUL. | 1554 | don't ignore break, but don't signal either, so it looks like NUL. |
| 1561 | This really serves a purpose only if running in an XTERM window | 1555 | This really serves a purpose only if running in an XTERM window |
| 1562 | or via TELNET or the like, but does no harm elsewhere. */ | 1556 | or via TELNET or the like, but does no harm elsewhere. */ |
| 1563 | tty.main.c_iflag &= ~IGNBRK; | 1557 | tty.main.c_iflag &= ~IGNBRK; |
| 1564 | tty.main.c_iflag &= ~BRKINT; | 1558 | tty.main.c_iflag &= ~BRKINT; |
| 1565 | #endif | 1559 | #endif |
| 1566 | #else /* if not HAVE_TERMIO */ | 1560 | #else /* if not HAVE_TERMIO */ |
| 1567 | #ifdef VMS | 1561 | #ifdef VMS |
| 1568 | tty.main.tt_char |= TT$M_NOECHO; | 1562 | tty.main.tt_char |= TT$M_NOECHO; |
| 1569 | if (meta_key) | 1563 | if (meta_key) |
| 1570 | tty.main.tt_char |= TT$M_EIGHTBIT; | 1564 | tty.main.tt_char |= TT$M_EIGHTBIT; |
| 1571 | if (tty_out->flow_control) | 1565 | if (tty_out->flow_control) |
| 1572 | tty.main.tt_char |= TT$M_TTSYNC; | 1566 | tty.main.tt_char |= TT$M_TTSYNC; |
| 1573 | else | 1567 | else |
| 1574 | tty.main.tt_char &= ~TT$M_TTSYNC; | 1568 | tty.main.tt_char &= ~TT$M_TTSYNC; |
| 1575 | tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON; | 1569 | tty.main.tt2_char |= TT2$M_PASTHRU | TT2$M_XON; |
| 1576 | #else /* not VMS (BSD, that is) */ | 1570 | #else /* not VMS (BSD, that is) */ |
| 1577 | #ifndef DOS_NT | 1571 | #ifndef DOS_NT |
| 1578 | XSETINT (Vtty_erase_char, tty.main.sg_erase); | 1572 | XSETINT (Vtty_erase_char, tty.main.sg_erase); |
| 1579 | tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); | 1573 | tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS); |
| 1580 | if (meta_key) | 1574 | if (meta_key) |
| 1581 | tty.main.sg_flags |= ANYP; | 1575 | tty.main.sg_flags |= ANYP; |
| 1582 | tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; | 1576 | tty.main.sg_flags |= interrupt_input ? RAW : CBREAK; |
| 1583 | #endif /* not DOS_NT */ | 1577 | #endif /* not DOS_NT */ |
| 1584 | #endif /* not VMS (BSD, that is) */ | 1578 | #endif /* not VMS (BSD, that is) */ |
| 1585 | #endif /* not HAVE_TERMIO */ | 1579 | #endif /* not HAVE_TERMIO */ |
| 1586 | 1580 | ||
| 1587 | /* If going to use CBREAK mode, we must request C-g to interrupt | 1581 | /* If going to use CBREAK mode, we must request C-g to interrupt |
| 1588 | and turn off start and stop chars, etc. If not going to use | 1582 | and turn off start and stop chars, etc. If not going to use |
| 1589 | CBREAK mode, do this anyway so as to turn off local flow | 1583 | CBREAK mode, do this anyway so as to turn off local flow |
| 1590 | control for user coming over network on 4.2; in this case, | 1584 | control for user coming over network on 4.2; in this case, |
| 1591 | only t_stopc and t_startc really matter. */ | 1585 | only t_stopc and t_startc really matter. */ |
| 1592 | #ifndef HAVE_TERMIO | 1586 | #ifndef HAVE_TERMIO |
| 1593 | #ifdef HAVE_TCHARS | 1587 | #ifdef HAVE_TCHARS |
| 1594 | /* Note: if not using CBREAK mode, it makes no difference how we | 1588 | /* Note: if not using CBREAK mode, it makes no difference how we |
| 1595 | set this */ | 1589 | set this */ |
| 1596 | tty.tchars = new_tchars; | 1590 | tty.tchars = new_tchars; |
| 1597 | tty.tchars.t_intrc = quit_char; | 1591 | tty.tchars.t_intrc = quit_char; |
| 1598 | if (tty_out->flow_control) | 1592 | if (tty_out->flow_control) |
| 1599 | { | 1593 | { |
| 1600 | tty.tchars.t_startc = '\021'; | 1594 | tty.tchars.t_startc = '\021'; |
| 1601 | tty.tchars.t_stopc = '\023'; | 1595 | tty.tchars.t_stopc = '\023'; |
| 1602 | } | 1596 | } |
| 1603 | 1597 | ||
| 1604 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; | 1598 | tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode; |
| 1605 | #ifdef ultrix | 1599 | #ifdef ultrix |
| 1606 | /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt | 1600 | /* Under Ultrix 4.2a, leaving this out doesn't seem to hurt |
| 1607 | anything, and leaving it in breaks the meta key. Go figure. */ | 1601 | anything, and leaving it in breaks the meta key. Go figure. */ |
| 1608 | tty.lmode &= ~LLITOUT; | 1602 | tty.lmode &= ~LLITOUT; |
| 1609 | #endif | 1603 | #endif |
| 1610 | 1604 | ||
| 1611 | #ifdef BSD4_1 | 1605 | #ifdef BSD4_1 |
| 1612 | lmode = tty.lmode; | 1606 | lmode = tty.lmode; |
| 1613 | #endif | 1607 | #endif |
| 1614 | 1608 | ||
| 1615 | #endif /* HAVE_TCHARS */ | 1609 | #endif /* HAVE_TCHARS */ |
| 1616 | #endif /* not HAVE_TERMIO */ | 1610 | #endif /* not HAVE_TERMIO */ |
| 1617 | 1611 | ||
| 1618 | #ifdef HAVE_LTCHARS | 1612 | #ifdef HAVE_LTCHARS |
| 1619 | tty.ltchars = new_ltchars; | 1613 | tty.ltchars = new_ltchars; |
| 1620 | #endif /* HAVE_LTCHARS */ | 1614 | #endif /* HAVE_LTCHARS */ |
| 1621 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ | 1615 | #ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ |
| 1622 | if (!tty_out->term_initted) | 1616 | if (!tty_out->term_initted) |
| 1623 | internal_terminal_init (); | 1617 | internal_terminal_init (); |
| 1624 | dos_ttraw (); | 1618 | dos_ttraw (); |
| 1625 | #endif | 1619 | #endif |
| 1626 | 1620 | ||
| 1627 | EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), &tty, 0); | 1621 | EMACS_SET_TTY (fileno (TTY_INPUT (tty_out)), &tty, 0); |
| 1628 | 1622 | ||
| 1629 | /* This code added to insure that, if flow-control is not to be used, | 1623 | /* This code added to insure that, if flow-control is not to be used, |
| 1630 | we have an unlocked terminal at the start. */ | 1624 | we have an unlocked terminal at the start. */ |
| 1631 | 1625 | ||
| 1632 | #ifdef TCXONC | 1626 | #ifdef TCXONC |
| 1633 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); | 1627 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TCXONC, 1); |
| 1634 | #endif | 1628 | #endif |
| 1635 | #ifndef APOLLO | 1629 | #ifndef APOLLO |
| 1636 | #ifdef TIOCSTART | 1630 | #ifdef TIOCSTART |
| 1637 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); | 1631 | if (!tty_out->flow_control) ioctl (fileno (TTY_INPUT (tty_out)), TIOCSTART, 0); |
| 1638 | #endif | 1632 | #endif |
| 1639 | #endif | 1633 | #endif |
| 1640 | 1634 | ||
| 1641 | #if defined (HAVE_TERMIOS) || defined (HPUX9) | 1635 | #if defined (HAVE_TERMIOS) || defined (HPUX9) |
| 1642 | #ifdef TCOON | 1636 | #ifdef TCOON |
| 1643 | if (!tty_out->flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); | 1637 | if (!tty_out->flow_control) tcflow (fileno (TTY_INPUT (tty_out)), TCOON); |
| 1644 | #endif | 1638 | #endif |
| 1645 | #endif | 1639 | #endif |
| 1646 | 1640 | ||
| 1647 | #ifdef AIXHFT | 1641 | #ifdef AIXHFT |
| 1648 | hft_init (tty_out); | 1642 | hft_init (tty_out); |
| 1649 | #ifdef IBMR2AIX | 1643 | #ifdef IBMR2AIX |
| 1650 | { | 1644 | { |
| 1651 | /* IBM's HFT device usually thinks a ^J should be LF/CR. We need it | 1645 | /* IBM's HFT device usually thinks a ^J should be LF/CR. We need it |
| 1652 | to be only LF. This is the way that is done. */ | 1646 | to be only LF. This is the way that is done. */ |
| 1653 | struct termio tty; | 1647 | struct termio tty; |
| 1654 | 1648 | ||
| 1655 | if (ioctl (1, HFTGETID, &tty) != -1) | 1649 | if (ioctl (1, HFTGETID, &tty) != -1) |
| 1656 | write (1, "\033[20l", 5); | 1650 | write (1, "\033[20l", 5); |
| 1657 | } | 1651 | } |
| 1658 | #endif | 1652 | #endif |
| 1659 | #endif /* AIXHFT */ | 1653 | #endif /* AIXHFT */ |
| 1660 | 1654 | ||
| @@ -1663,15 +1657,13 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1663 | SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, | 1657 | SYS$QIOW (0, fileno (TTY_INPUT (tty_out)), IO$_SETMODE|IO$M_OUTBAND, 0, 0, 0, |
| 1664 | interrupt_signal, oob_chars, 0, 0, 0, 0); | 1658 | interrupt_signal, oob_chars, 0, 0, 0, 0); |
| 1665 | */ | 1659 | */ |
| 1666 | queue_kbd_input (0); | 1660 | queue_kbd_input (0); |
| 1667 | #endif /* VMS */ | 1661 | #endif /* VMS */ |
| 1668 | } | ||
| 1669 | 1662 | ||
| 1670 | #ifdef F_SETFL | 1663 | #ifdef F_SETFL |
| 1671 | #ifndef F_SETOWN_BUG | 1664 | #ifndef F_SETOWN_BUG |
| 1672 | #ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ | 1665 | #ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */ |
| 1673 | if (interrupt_input | 1666 | if (interrupt_input) |
| 1674 | && (tty_out->input != stdin || EQ (Vwindow_system, Qnil))) | ||
| 1675 | { | 1667 | { |
| 1676 | old_fcntl_owner[fileno (TTY_INPUT (tty_out))] = | 1668 | old_fcntl_owner[fileno (TTY_INPUT (tty_out))] = |
| 1677 | fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); | 1669 | fcntl (fileno (TTY_INPUT (tty_out)), F_GETOWN, 0); |
| @@ -1699,20 +1691,7 @@ nil means don't delete them until `list-processes' is run. */); | |||
| 1699 | setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); | 1691 | setbuf (TTY_OUTPUT (tty_out), (char *) _sobuf); |
| 1700 | #endif | 1692 | #endif |
| 1701 | 1693 | ||
| 1702 | #if 0 /* We always need this with multi-tty support. */ | 1694 | tty_set_terminal_modes (tty_out->display); |
| 1703 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1704 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | ||
| 1705 | needs the initialization code below. */ | ||
| 1706 | if (EQ (Vwindow_system, Qnil) | ||
| 1707 | #ifndef WINDOWSNT | ||
| 1708 | /* When running in tty mode on NT/Win95, we have a read_socket | ||
| 1709 | hook, but still need the rest of the initialization code below. */ | ||
| 1710 | && (! read_socket_hook) | ||
| 1711 | #endif | ||
| 1712 | ) | ||
| 1713 | #endif | ||
| 1714 | #endif | ||
| 1715 | tty_set_terminal_modes (tty_out->display); | ||
| 1716 | 1695 | ||
| 1717 | if (!tty_out->term_initted) | 1696 | if (!tty_out->term_initted) |
| 1718 | { | 1697 | { |
| @@ -1875,21 +1854,6 @@ reset_sys_modes (tty_out) | |||
| 1875 | } | 1854 | } |
| 1876 | if (!tty_out->term_initted) | 1855 | if (!tty_out->term_initted) |
| 1877 | return; | 1856 | return; |
| 1878 | #if 0 /* We always need to do this with multi-tty support. */ | ||
| 1879 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1880 | /* Emacs' window system on MSDOG uses the `internal terminal' and therefore | ||
| 1881 | needs the clean-up code below. */ | ||
| 1882 | if (tty_out->input != stdin | ||
| 1883 | || (!EQ (Vwindow_system, Qnil) | ||
| 1884 | #ifndef WINDOWSNT | ||
| 1885 | /* When running in tty mode on NT/Win95, we have a read_socket | ||
| 1886 | hook, but still need the rest of the clean-up code below. */ | ||
| 1887 | || read_socket_hook | ||
| 1888 | #endif | ||
| 1889 | )) | ||
| 1890 | return; | ||
| 1891 | #endif | ||
| 1892 | #endif | ||
| 1893 | 1857 | ||
| 1894 | cmgoto (tty_out, FrameRows (tty_out) - 1, 0); | 1858 | cmgoto (tty_out, FrameRows (tty_out) - 1, 0); |
| 1895 | #if 0 /* XXX This doesn't work anymore, the signature has changed. */ | 1859 | #if 0 /* XXX This doesn't work anymore, the signature has changed. */ |
| @@ -2578,7 +2542,9 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2578 | SELECT_TYPE *rfds, *wfds, *efds; | 2542 | SELECT_TYPE *rfds, *wfds, *efds; |
| 2579 | EMACS_TIME *timeout; | 2543 | EMACS_TIME *timeout; |
| 2580 | { | 2544 | { |
| 2581 | int ravail = 0; | 2545 | /* XXX This needs to be updated for multi-tty support. Is there |
| 2546 | anybody who needs to emulate select these days? */ | ||
| 2547 | int ravail = 0; | ||
| 2582 | SELECT_TYPE orfds; | 2548 | SELECT_TYPE orfds; |
| 2583 | int timeoutval; | 2549 | int timeoutval; |
| 2584 | int *local_timeout; | 2550 | int *local_timeout; |
| @@ -2593,7 +2559,7 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2593 | #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) | 2559 | #if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS) |
| 2594 | /* If we're using X, then the native select will work; we only need the | 2560 | /* If we're using X, then the native select will work; we only need the |
| 2595 | emulation for non-X usage. */ | 2561 | emulation for non-X usage. */ |
| 2596 | if (!NILP (Vwindow_system)) | 2562 | if (!NILP (Vinitial_window_system)) |
| 2597 | return select (nfds, rfds, wfds, efds, timeout); | 2563 | return select (nfds, rfds, wfds, efds, timeout); |
| 2598 | #endif | 2564 | #endif |
| 2599 | timeoutval = timeout ? EMACS_SECS (*timeout) : 100000; | 2565 | timeoutval = timeout ? EMACS_SECS (*timeout) : 100000; |
| @@ -2717,8 +2683,8 @@ sys_select (nfds, rfds, wfds, efds, timeout) | |||
| 2717 | void | 2683 | void |
| 2718 | read_input_waiting () | 2684 | read_input_waiting () |
| 2719 | { | 2685 | { |
| 2720 | /* XXX This needs to be updated for multi-tty support. Does | 2686 | /* XXX This needs to be updated for multi-tty support. Is there |
| 2721 | anybody need to emulate select these days? */ | 2687 | anybody who needs to emulate select these days? */ |
| 2722 | int nread, i; | 2688 | int nread, i; |
| 2723 | extern int quit_char; | 2689 | extern int quit_char; |
| 2724 | 2690 | ||
diff --git a/src/window.h b/src/window.h index 0a4bdb6e891..f45ca39bb93 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -744,7 +744,7 @@ extern Lisp_Object Vminibuf_scroll_window; | |||
| 744 | /* Nil or a symbol naming the window system under which emacs is | 744 | /* Nil or a symbol naming the window system under which emacs is |
| 745 | running ('x is the only current possibility) */ | 745 | running ('x is the only current possibility) */ |
| 746 | 746 | ||
| 747 | extern Lisp_Object Vwindow_system; | 747 | extern Lisp_Object Vinitial_window_system; |
| 748 | 748 | ||
| 749 | /* Version number of X windows: 10, 11 or nil. */ | 749 | /* Version number of X windows: 10, 11 or nil. */ |
| 750 | 750 | ||
diff --git a/src/xfns.c b/src/xfns.c index 3a1c861686d..fc8ee0af77f 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3188,8 +3188,6 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3188 | Lisp_Object parent; | 3188 | Lisp_Object parent; |
| 3189 | struct kboard *kb; | 3189 | struct kboard *kb; |
| 3190 | 3190 | ||
| 3191 | check_x (); | ||
| 3192 | |||
| 3193 | /* Use this general default value to start with | 3191 | /* Use this general default value to start with |
| 3194 | until we know if this frame has a specified name. */ | 3192 | until we know if this frame has a specified name. */ |
| 3195 | Vx_resource_name = Vinvocation_name; | 3193 | Vx_resource_name = Vinvocation_name; |
| @@ -4124,8 +4122,10 @@ x_display_info_for_name (name) | |||
| 4124 | 4122 | ||
| 4125 | CHECK_STRING (name); | 4123 | CHECK_STRING (name); |
| 4126 | 4124 | ||
| 4127 | if (! EQ (Vwindow_system, intern ("x"))) | 4125 | #if 0 |
| 4128 | error ("Not using X Windows"); | 4126 | if (! EQ (Vinitial_window_system, intern ("x"))) |
| 4127 | error ("Not using X Windows"); /* That doesn't stop us anymore. */ | ||
| 4128 | #endif | ||
| 4129 | 4129 | ||
| 4130 | for (dpyinfo = x_display_list, names = x_display_name_list; | 4130 | for (dpyinfo = x_display_list, names = x_display_name_list; |
| 4131 | dpyinfo; | 4131 | dpyinfo; |
| @@ -4172,8 +4172,10 @@ terminate Emacs if we can't open the connection. */) | |||
| 4172 | if (! NILP (xrm_string)) | 4172 | if (! NILP (xrm_string)) |
| 4173 | CHECK_STRING (xrm_string); | 4173 | CHECK_STRING (xrm_string); |
| 4174 | 4174 | ||
| 4175 | if (! EQ (Vwindow_system, intern ("x"))) | 4175 | #if 0 |
| 4176 | error ("Not using X Windows"); | 4176 | if (! EQ (Vinitial_window_system, intern ("x"))) |
| 4177 | error ("Not using X Windows"); /* That doesn't stop us anymore. */ | ||
| 4178 | #endif | ||
| 4177 | 4179 | ||
| 4178 | if (! NILP (xrm_string)) | 4180 | if (! NILP (xrm_string)) |
| 4179 | xrm_option = (unsigned char *) SDATA (xrm_string); | 4181 | xrm_option = (unsigned char *) SDATA (xrm_string); |