;;; frame.el --- multi-frame management independent of window systems
;; Copyright (C) 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003,
-;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: internal
;; Get rid of `name' unless it was specified explicitly before.
(or (assq 'name frame-initial-frame-alist)
(setq parms (delq (assq 'name parms) parms)))
+ ;; An explicit parent-id is a request to XEmbed the frame.
+ (or (assq 'parent-id frame-initial-frame-alist)
+ (setq parms (delq (assq 'parent-id parms) parms)))
(setq parms (append initial-frame-alist
window-system-frame-alist
(defun display-mm-height (&optional display)
"Return the height of DISPLAY's screen in millimeters.
-System values can be overriden by `display-mm-dimensions-alist'.
+System values can be overridden by `display-mm-dimensions-alist'.
If the information is unavailable, value is nil."
(and (memq (framep-on-display display) '(x w32 mac))
(or (cddr (assoc (or display (frame-parameter nil 'display))
(defun display-mm-width (&optional display)
"Return the width of DISPLAY's screen in millimeters.
-System values can be overriden by `display-mm-dimensions-alist'.
+System values can be overridden by `display-mm-dimensions-alist'.
If the information is unavailable, value is nil."
(and (memq (framep-on-display display) '(x w32 mac))
(or (cadr (assoc (or display (frame-parameter nil 'display))
'static-gray))))
\f
+;;;; Frame geometry values
+
+(defun frame-geom-value-cons (type value &optional frame)
+ "Return equivalent geometry value for FRAME as a cons with car `+'.
+A geometry value equivalent to VALUE for FRAME is returned,
+where the value is a cons with car `+', not numeric.
+TYPE is the car of the original geometry spec (TYPE . VALUE).
+ It is `top' or `left', depending on which edge VALUE is related to.
+VALUE is the cdr of a frame geometry spec: (left/top . VALUE).
+If VALUE is a number, then it is converted to a cons value, perhaps
+ relative to the opposite frame edge from that in the original spec.
+FRAME defaults to the selected frame.
+
+Examples (measures in pixels) -
+ Assuming display height/width=1024, frame height/width=600:
+ 300 inside display edge: 300 => (+ 300)
+ (+ 300) => (+ 300)
+ 300 inside opposite display edge: (- 300) => (+ 124)
+ -300 => (+ 124)
+ 300 beyond display edge
+ (= 724 inside opposite display edge): (+ -300) => (+ -300)
+ 300 beyond display edge
+ (= 724 inside opposite display edge): (- -300) => (+ 724)
+
+In the 3rd, 4th, and 6th examples, the returned value is relative to
+the opposite frame edge from the edge indicated in the input spec."
+ (cond ((and (consp value) (eq '+ (car value))) ; e.g. (+ 300), (+ -300)
+ value)
+ ((natnump value) (list '+ value)) ; e.g. 300 => (+ 300)
+ (t ; e.g. -300, (- 300), (- -300)
+ (list '+ (- (if (eq 'left type) ; => (+ 124), (+ 124), (+ 724)
+ (x-display-pixel-width)
+ (x-display-pixel-height))
+ (if (integerp value) (- value) (cadr value))
+ (if (eq 'left type)
+ (frame-pixel-width frame)
+ (frame-pixel-height frame)))))))
+
+(defun frame-geom-spec-cons (spec &optional frame)
+ "Return equivalent geometry spec for FRAME as a cons with car `+'.
+A geometry specification equivalent to SPEC for FRAME is returned,
+where the value is a cons with car `+', not numeric.
+SPEC is a frame geometry spec: (left . VALUE) or (top . VALUE).
+If VALUE is a number, then it is converted to a cons value, perhaps
+ relative to the opposite frame edge from that in the original spec.
+FRAME defaults to the selected frame.
+
+Examples (measures in pixels) -
+ Assuming display height=1024, frame height=600:
+ top 300 below display top: (top . 300) => (top + 300)
+ (top + 300) => (top + 300)
+ bottom 300 above display bottom: (top - 300) => (top + 124)
+ (top . -300) => (top + 124)
+ top 300 above display top
+ (= bottom 724 above display bottom): (top + -300) => (top + -300)
+ bottom 300 below display bottom
+ (= top 724 below display top): (top - -300) => (top + 724)
+
+In the 3rd, 4th, and 6th examples, the returned value is relative to
+the opposite frame edge from the edge indicated in the input spec."
+ (cons (car spec) (frame-geom-value-cons (car spec) (cdr spec))))
+\f
;;;; Aliases for backward compatibility with Emacs 18.
(define-obsolete-function-alias 'screen-height 'frame-height) ;before 19.15
(define-obsolete-function-alias 'screen-width 'frame-width) ;before 19.15