Function: x-create-frame-with-faces

x-create-frame-with-faces is a byte-compiled function defined in faces.el.gz.

Signature

(x-create-frame-with-faces &optional PARAMETERS)

Documentation

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.

Source Code

;; Defined in /usr/src/emacs/lisp/faces.el.gz
(defun x-create-frame-with-faces (&optional parameters)
  "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))
	 (delayed-params '(foreground-color background-color font
			   border-color cursor-color mouse-color
			   visibility scroll-bar-foreground
			   scroll-bar-background))
         (delayed-font nil)
	 frame success)
    (dolist (param delayed-params)
      ;; Save the font used here.  Once the frame is created, set the
      ;; `font-parameter' frame parameter.
      (when (and (eq param 'font) (assq 'font parameters))
        (setq delayed-font (cdr (assq 'font parameters))))
      (setq params (assq-delete-all param params)))
    (setq frame (x-create-frame `((visibility . nil) . ,params)))
    (unwind-protect
	(progn
	  (x-setup-function-keys frame)
	  (dolist (face (face-list))
	    (face-spec-recalc face frame))
	  (x-handle-reverse-video frame parameters)
	  (frame-set-background-mode frame t)
	  (face-set-after-frame-default frame parameters)
          ;; The code above will not set the `font-parameter' frame
          ;; property, which is used by dynamic-setting.el to respect
          ;; fonts specified by the user via frame parameters (as
          ;; opposed to face attributes).  Set the parameter manually.
          (set-frame-parameter frame 'font-parameter delayed-font)
          ;; Mark frame as 'was-invisible' when it was created as
          ;; invisible or iconified and PARAMETERS contains either a
          ;; width or height specification.  This should be sufficient
          ;; to handle Bug#24526 (where a frame is initially iconified
          ;; to allow manipulating its size in a non-obtrusive way) and
          ;; avoid that a tiling window manager for GTK3 gets a resize
          ;; request it cannot handle (Bug#48268).  The 'was-invisible'
          ;; flag is eventually processed in xterm.c after we receive a
          ;; MapNotify event; non-X builds ignore it.
          (frame--set-was-invisible
           frame
           (and visibility-spec
                (memq (cdr visibility-spec) '(nil icon))
                (or (assq 'width parameters)
                    (assq 'height parameters))))

          (if (null visibility-spec)
	      (make-frame-visible frame)
	    (modify-frame-parameters frame (list visibility-spec)))
	  (setq success t))
      (unless success
	(delete-frame frame)))
    frame))