Commit 160f0817 authored by Karoly Lorentey's avatar Karoly Lorentey
Browse files

Make all frames created in an emacsclient session belong to that client.

* lisp/frame.el (make-frame): Also inherit 'client parameter.  Don't
  override explicitly specified values with inherited ones.

* server.el (server-delete-client): Delete frames after deleting the tty.
  Clear 'client parameter before deleting a frame.

* server.el (server-handle-delete-frame): Delete the client if this was
  its last frame.

* startup.el (fancy-splash-default-action): Fix typo in comment.

parent 2dfa0fac
......@@ -681,13 +681,16 @@ setup is for focus to follow the pointer."
(run-hooks 'before-make-frame-hook)
(setq frame (funcall frame-creation-function (append parameters (cdr (assq w window-system-default-frame-alist)))))
(normal-erase-is-backspace-setup-frame frame)
;; Set up the frame-local environment, if needed.
;; Inherit the 'environment and 'client parameters, if needed.
(when (eq (frame-terminal frame) (frame-terminal oldframe))
(let ((env (frame-parameter oldframe 'environment)))
(let ((env (frame-parameter oldframe 'environment))
(client (frame-parameter oldframe 'client)))
(if (not (framep env))
(setq env oldframe))
(if env
(set-frame-parameter frame 'environment env))))
(if (and env (not (assq 'environment parameters)))
(set-frame-parameter frame 'environment env))
(if (and client (not (assq 'client parameters)))
(set-frame-parameter frame 'client client))))
(run-hook-with-args 'after-make-frame-functions frame)
......@@ -270,18 +270,21 @@ If NOFRAME is non-nil, let the frames live. (To be used from
(kill-buffer (current-buffer))))))
;; Delete the client's frames.
(unless noframe
(dolist (frame (frame-list))
(when (and (frame-live-p frame)
(equal proc (frame-parameter frame 'client)))
;; Prevent `server-handle-delete-frame' from calling us
;; recursively.
(set-frame-parameter frame 'client nil)
(delete-frame frame))))
;; Delete the client's tty.
(let ((terminal (server-client-get client 'terminal)))
(when (eq (terminal-live-p terminal) t)
(delete-terminal terminal)))
;; Delete the client's frames.
(unless noframe
(dolist (frame (frame-list))
(if (and (frame-live-p frame)
(equal (car client) (frame-parameter frame 'client)))
(delete-frame frame))))
;; Delete the client's process.
(if (eq (process-status (car client)) 'open)
(delete-process (car client)))
......@@ -318,16 +321,12 @@ message."
(let ((proc (frame-parameter frame 'client)))
(when (and (frame-live-p frame)
(or (window-system frame)
;; A terminal device must not yet be deleted if
;; there are other frames on it.
(< 0 (let ((frame-num 0))
(mapc (lambda (f)
(when (eq (frame-terminal f)
(frame-terminal frame))
(setq frame-num (1+ frame-num))))
;; See if this is the last frame for this client.
(< 1 (let ((frame-num 0))
(dolist ((f (frame-list)))
(when (eq proc (frame-parameter f 'client))
(setq frame-num (1+ frame-num))))
(server-log (format "server-handle-delete-frame, frame %s" frame) proc)
(server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later.
......@@ -1299,7 +1299,7 @@ mouse."
(if (and (memq 'down (event-modifiers last-command-event))
(eq (posn-window (event-start last-command-event))
;; This is a mouse-down event in the spash screen window.
;; This is a mouse-down event in the splash screen window.
;; Ignore it and consume the corresponding mouse-up event.
(push last-command-event unread-command-events))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment