From: Dmitry Antipov Date: Sat, 6 Apr 2013 14:06:39 +0000 (+0400) Subject: Do not set x-display-name until X connection is established. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~519 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ebb19708e7c76af8eee5534e25de5fa0949c14b4;p=emacs.git Do not set x-display-name until X connection is established. This is needed to prevent from weird situation described at . * frame.el (make-frame): Set x-display-name after call to window system initialization function, not before. * term/x-win.el (x-initialize-window-system): Add optional display argument and use it. * term/w32-win.el (w32-initialize-window-system): * term/ns-win.el (ns-initialize-window-system): * term/pc-win.el (msdos-initialize-window-system): Add compatible optional display argument. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b249977e4e..bfbdf089bfa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2013-04-06 Dmitry Antipov + + Do not set x-display-name until X connection is established. + This is needed to prevent from weird situation described at + . + * frame.el (make-frame): Set x-display-name after call to + window system initialization function, not before. + * term/x-win.el (x-initialize-window-system): Add optional + display argument and use it. + * term/w32-win.el (w32-initialize-window-system): + * term/ns-win.el (ns-initialize-window-system): + * term/pc-win.el (msdos-initialize-window-system): + Add compatible optional display argument. + 2013-04-06 Eli Zaretskii * files.el (normal-backup-enable-predicate): On MS-Windows and diff --git a/lisp/frame.el b/lisp/frame.el index 4bf885b27b2..454b229d59e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -655,9 +655,8 @@ the new frame according to its own rules." (error "Don't know how to create a frame on window system %s" w)) (unless (get w 'window-system-initialized) - (unless x-display-name - (setq x-display-name display)) - (funcall (cdr (assq w window-system-initialization-alist))) + (funcall (cdr (assq w window-system-initialization-alist)) display) + (setq x-display-name display) (put w 'window-system-initialized t)) ;; Add parameters from `window-system-default-frame-alist'. diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index b8baaa077ce..5617c31beff 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -895,7 +895,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; Do the actual Nextstep Windows setup here; the above code just ;; defines functions and variables that we use now. -(defun ns-initialize-window-system () +(defun ns-initialize-window-system (&optional display) "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." (cl-assert (not ns-initialized)) diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index cf67aca8343..ab776ea6257 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -403,7 +403,7 @@ Errors out because it is not supposed to be called, ever." (error "terminal-init-internal called for window-system `%s'" (window-system))) -(defun msdos-initialize-window-system () +(defun msdos-initialize-window-system (&optional display) "Initialization function for the `pc' \"window system\"." (or (eq (window-system) 'pc) (error diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index cbd08e68a39..b0f65812eab 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -246,7 +246,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") (declare-function x-parse-geometry "frame.c" (string)) (defvar x-command-line-resources) -(defun w32-initialize-window-system () +(defun w32-initialize-window-system (&optional display) "Initialize Emacs for W32 GUI frames." (cl-assert (not w32-initialized)) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 84d6ddbf46c..822df0e37e5 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1343,7 +1343,7 @@ Request data types in the order specified by `x-select-request-type'." (defvar x-display-name) (defvar x-command-line-resources) -(defun x-initialize-window-system () +(defun x-initialize-window-system (&optional display) "Initialize Emacs for X frames and open the first connection to an X server." (cl-assert (not x-initialized)) @@ -1357,7 +1357,7 @@ Request data types in the order specified by `x-select-request-type'." (while (setq i (string-match "[.*]" x-resource-name)) (aset x-resource-name i ?-)))) - (x-open-connection (or x-display-name + (x-open-connection (or display (setq x-display-name (or (getenv "DISPLAY" (selected-frame)) (getenv "DISPLAY")))) x-command-line-resources