Commit e09c52a8 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(face-initialize): New function.

All initialization code moved into it.
Call at end of file, if using X frames already.
(x-create-frame-with-faces): Don't use faces if not initialized.
parent fc4d4afb
......@@ -604,8 +604,7 @@ If NOERROR is non-nil, return nil on failure."
;;; Make the builtin faces; the C code knows these as faces 0, 1, and 2,
;;; respectively, so they must be the first three faces made.
(if (internal-find-face 'default)
nil
(defun face-initialize ()
(make-face 'default)
(make-face 'modeline)
(make-face 'highlight)
......@@ -617,7 +616,15 @@ If NOERROR is non-nil, return nil on failure."
(make-face 'italic)
(make-face 'bold-italic)
(make-face 'primary-selection)
(make-face 'secondary-selection))
(make-face 'secondary-selection)
;; Set up the faces of all existing X Window frames.
(let ((frames (frame-list)))
(while frames
(if (eq (framep (car frames)) 'x)
(x-initialize-frame-faces (car frames)))
(setq frames (cdr frames)))))
;;; This really belongs in setting a frame's own font.
;;; ;;
......@@ -714,41 +721,40 @@ If NOERROR is non-nil, return nil on failure."
;; Like x-create-frame but also set up the faces.
(defun x-create-frame-with-faces (&optional parameters)
(let* ((frame (x-create-frame parameters))
(faces (copy-alist global-face-data))
(rest faces)
default modeline)
(set-frame-face-alist frame faces)
;; Copy the vectors that represent the faces.
;; Also fill them in from X resources.
(while rest
(setcdr (car rest) (copy-sequence (cdr (car rest))))
(make-face-x-resource-internal (cdr (car rest)) frame t)
(setq rest (cdr rest)))
(setq default (internal-get-face 'default frame)
modeline (internal-get-face 'modeline frame))
(x-initialize-frame-faces frame)
;;; ;; Make sure the modeline face is fully qualified.
;;; (if (and (not (face-font modeline frame)) (face-font default frame))
;;; (set-face-font modeline (face-font default frame) frame))
;;; (if (and (not (face-background modeline frame))
;;; (face-background default frame))
;;; (set-face-background modeline (face-background default frame) frame))
;;; (if (and (not (face-foreground modeline frame))
;;; (face-foreground default frame))
;;; (set-face-foreground modeline (face-foreground default frame) frame))
frame))
;; Set up the faces of all existing frames.
(let ((frames (frame-list)))
(while frames
(if (eq (framep (car frames)) 'x)
(x-initialize-frame-faces (car frames)))
(setq frames (cdr frames))))
(if (null global-face-data)
(x-create-frame parameters)
(let* ((frame (x-create-frame parameters))
(faces (copy-alist global-face-data))
(rest faces)
default modeline)
(set-frame-face-alist frame faces)
;; Copy the vectors that represent the faces.
;; Also fill them in from X resources.
(while rest
(setcdr (car rest) (copy-sequence (cdr (car rest))))
(make-face-x-resource-internal (cdr (car rest)) frame t)
(setq rest (cdr rest)))
(setq default (internal-get-face 'default frame)
modeline (internal-get-face 'modeline frame))
(x-initialize-frame-faces frame)
;;; ;; Make sure the modeline face is fully qualified.
;;; (if (and (not (face-font modeline frame)) (face-font default frame))
;;; (set-face-font modeline (face-font default frame) frame))
;;; (if (and (not (face-background modeline frame))
;;; (face-background default frame))
;;; (set-face-background modeline (face-background default frame) frame))
;;; (if (and (not (face-foreground modeline frame))
;;; (face-foreground default frame))
;;; (set-face-foreground modeline (face-foreground default frame) frame))
frame)))
;; If we are already using x-window frames, initialize faces for them.
(if (eq (framep (selected-frame)) 'x)
(face-initialize))
(provide 'faces)
......
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