1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-13 16:38:14 +00:00

Fix application of default-frame-alist (Bug#5378).

* lisp/frame.el (make-frame): Add default-frame-alist to the PARAMETERS
argument passed to frame-creation-function (Bug#5378).

* lisp/faces.el (x-handle-named-frame-geometry)
(x-handle-reverse-video, x-create-frame-with-faces)
(face-set-after-frame-default, tty-create-frame-with-faces): Don't
separately consult default-frame-alist.  It is now passed as the
PARAMETER argument.

* src/frame.c (get_future_frame_param, Fmake_terminal_frame): Don't
check default-frame-alist.
This commit is contained in:
Chong Yidong 2010-06-30 20:14:17 -04:00
parent acd0102aa4
commit c1ef4455ea
5 changed files with 54 additions and 41 deletions

View File

@ -1,3 +1,14 @@
2010-06-30 Chong Yidong <cyd@stupidchicken.com>
* frame.el (make-frame): Add default-frame-alist to the PARAMETERS
argument passed to frame-creation-function (Bug#5378).
* faces.el (x-handle-named-frame-geometry)
(x-handle-reverse-video, x-create-frame-with-faces)
(face-set-after-frame-default, tty-create-frame-with-faces): Don't
separately consult default-frame-alist. It is now passed as the
PARAMETER argument.
2010-06-30 Andreas Schwab <schwab@linux-m68k.org>
* startup.el (command-line): Don't call tool-bar-setup in a

View File

@ -1948,8 +1948,7 @@ according to the `background-mode' and `display-type' frame parameters."
"Add geometry parameters for a named frame to parameter list PARAMETERS.
Value is the new parameter list."
;; Note that `x-resource-name' has a global meaning.
(let ((x-resource-name (or (cdr (assq 'name parameters))
(cdr (assq 'name default-frame-alist)))))
(let ((x-resource-name (cdr (assq 'name parameters))))
(when x-resource-name
;; Before checking X resources, we must have an X connection.
(or (window-system)
@ -1960,7 +1959,7 @@ Value is the new parameter list."
(and (setq res-geometry (x-get-resource "geometry" "Geometry"))
(setq parsed (x-parse-geometry res-geometry))
(setq parameters
(append parameters default-frame-alist parsed
(append parameters parsed
;; If the resource specifies a position,
;; take note of that.
(if (or (assq 'top parsed) (assq 'left parsed))
@ -1972,7 +1971,6 @@ Value is the new parameter list."
"Handle the reverse-video frame parameter and X resource.
`x-create-frame' does not handle this one."
(when (cdr (or (assq 'reverse parameters)
(assq 'reverse default-frame-alist)
(let ((resource (x-get-resource "reverseVideo"
"ReverseVideo")))
(if resource
@ -1998,13 +1996,10 @@ Value is the new parameter list."
(declare-function x-setup-function-keys "term/x-win" (frame))
(defun x-create-frame-with-faces (&optional parameters)
"Create a frame from optional frame parameters PARAMETERS.
Parameters not specified by PARAMETERS are taken from
`default-frame-alist'. If PARAMETERS specify a frame name,
handle X geometry resources for that name. If either PARAMETERS
or `default-frame-alist' contains a `reverse' parameter, or
the X resource ``reverseVideo'' is present, handle that.
Value is the new frame created."
"Create and return a frame with frame parameters PARAMETERS.
If PARAMETERS specify a frame name, handle X geometry resources
for that name. If PARAMETERS includes a `reverse' parameter, or
the X resource ``reverseVideo'' is present, handle that."
(setq parameters (x-handle-named-frame-geometry parameters))
(let* ((params (copy-tree parameters))
(visibility-spec (assq 'visibility parameters))
@ -2035,7 +2030,7 @@ Value is the new frame created."
Calculate the face definitions using the face specs, custom theme
settings, X resources, and `face-new-frame-defaults'.
Finally, apply any relevant face attributes found amongst the
frame parameters in PARAMETERS and `default-frame-alist'."
frame parameters in PARAMETERS."
(dolist (face (nreverse (face-list))) ;Why reverse? --Stef
(condition-case ()
(progn
@ -2061,16 +2056,14 @@ frame parameters in PARAMETERS and `default-frame-alist'."
(mouse-color mouse :background))))
(dolist (param face-params)
(let* ((param-name (nth 0 param))
(value (cdr (or (assq param-name parameters)
(assq param-name default-frame-alist)))))
(value (cdr (assq param-name parameters))))
(if value
(set-face-attribute (nth 1 param) frame
(nth 2 param) value))))))
(defun tty-handle-reverse-video (frame parameters)
"Handle the reverse-video frame parameter for terminal frames."
(when (cdr (or (assq 'reverse parameters)
(assq 'reverse default-frame-alist)))
(when (cdr (assq 'reverse parameters))
(let* ((params (frame-parameters frame))
(bg (cdr (assq 'foreground-color params)))
(fg (cdr (assq 'background-color params))))
@ -2086,11 +2079,8 @@ frame parameters in PARAMETERS and `default-frame-alist'."
(defun tty-create-frame-with-faces (&optional parameters)
"Create a frame from optional frame parameters PARAMETERS.
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."
"Create and return a frame from optional frame parameters PARAMETERS.
If PARAMETERS contains a `reverse' parameter, handle that."
(let ((frame (make-terminal-frame parameters))
success)
(unwind-protect

View File

@ -683,15 +683,17 @@ The functions are run with one arg, the newly created frame.")
(defun make-frame (&optional parameters)
"Return a newly created frame displaying the current buffer.
Optional argument PARAMETERS is an alist of parameters for the new frame.
Each element of PARAMETERS should have the form (NAME . VALUE), for example:
Optional argument PARAMETERS is an alist of frame parameters for
the new frame. Each element of PARAMETERS should have the
form (NAME . VALUE), for example:
(name . STRING) The frame should be named STRING.
(width . NUMBER) The frame should be NUMBER characters in width.
(height . NUMBER) The frame should be NUMBER text lines high.
You cannot specify either `width' or `height', you must use neither or both.
You cannot specify either `width' or `height', you must specify
neither or both.
(minibuffer . t) The frame should have a minibuffer.
(minibuffer . nil) The frame should have no minibuffer.
@ -703,15 +705,17 @@ You cannot specify either `width' or `height', you must use neither or both.
(terminal . TERMINAL) The frame should use the terminal object TERMINAL.
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.
In addition, any parameter specified in `default-frame-alist',
but not present in PARAMETERS, is applied.
This function itself does not make the new frame the selected frame.
The previously selected frame remains selected. However, the
window system may select the new frame for its own reasons, for
instance if the frame appears under the mouse pointer and your
setup is for focus to follow the pointer."
Before creating the frame (via `frame-creation-function-alist'),
this function runs the hook `before-make-frame-hook'. After
creating the frame, it runs the hook `after-make-frame-functions'
with one arg, the newly created frame.
On graphical displays, this function does not itself make the new
frame the selected frame. However, the window system may select
the new frame according to its own rules."
(interactive)
(let* ((w (cond
((assq 'terminal parameters)
@ -726,14 +730,21 @@ setup is for focus to follow the pointer."
(t window-system)))
(frame-creation-function (cdr (assq w frame-creation-function-alist)))
(oldframe (selected-frame))
(params parameters)
frame)
(unless frame-creation-function
(error "Don't know how to create a frame on window system %s" w))
;; Add parameters from `window-system-default-frame-alist'.
(dolist (p (cdr (assq w window-system-default-frame-alist)))
(unless (memq (car p) params)
(push p params)))
;; Add parameters from `default-frame-alist'.
(dolist (p default-frame-alist)
(unless (memq (car p) params)
(push p params)))
;; Now make the frame.
(run-hooks 'before-make-frame-hook)
(setq frame
(funcall frame-creation-function
(append parameters
(cdr (assq w window-system-default-frame-alist)))))
(setq frame (funcall frame-creation-function params))
(normal-erase-is-backspace-setup-frame frame)
;; Inherit the original frame's parameters.
(dolist (param frame-inherited-parameters)

View File

@ -1,3 +1,8 @@
2010-06-30 Chong Yidong <cyd@stupidchicken.com>
* frame.c (get_future_frame_param, Fmake_terminal_frame): Don't
check default-frame-alist.
2010-06-30 Andreas Schwab <schwab@linux-m68k.org>
* process.c (create_process): Avoid using invalid file descriptors.

View File

@ -627,8 +627,7 @@ make_terminal_frame (struct terminal *terminal)
/* Get a suitable value for frame parameter PARAMETER for a newly
created frame, based on (1) the user-supplied frame parameter
alist SUPPLIED_PARMS, (2) CURRENT_VALUE, and finally, if all else
fails, (3) Vdefault_frame_alist. */
alist SUPPLIED_PARMS, and (2) CURRENT_VALUE. */
static Lisp_Object
get_future_frame_param (Lisp_Object parameter,
@ -642,8 +641,6 @@ get_future_frame_param (Lisp_Object parameter,
result = Fassq (parameter, XFRAME (selected_frame)->param_alist);
if (NILP (result) && current_value != NULL)
result = build_string (current_value);
if (NILP (result))
result = Fassq (parameter, Vdefault_frame_alist);
if (!NILP (result) && !STRINGP (result))
result = XCDR (result);
if (NILP (result) || !STRINGP (result))
@ -748,7 +745,6 @@ affects all frames on the same terminal device. */)
adjust_glyphs (f);
calculate_costs (f);
XSETFRAME (frame, f);
Fmodify_frame_parameters (frame, Vdefault_frame_alist);
Fmodify_frame_parameters (frame, parms);
Fmodify_frame_parameters (frame, Fcons (Fcons (Qtty_type,
build_string (t->display_info.tty->type)),