Returns the geometry of the top level interface.
capi
top-level-interface-geometry interface => tx, ty, twidth, theight
interface⇩ |
An interface. |
Integers. |
The function top-level-interface-geometry
returns the coordinates of the given interface in a form suitable for use as the :best-x
, :best-y
, :best-width
and :best-height
initargs to interface. The value of interface should be a top level interface.
tx and ty are measured from the top-left of the screen rectangle representing the area of the primary monitor (the primary screen rectangle).
When displaying with GTK+ on Wayland, the desktop does not give the application to access or control the position of top level windows, so the values of tx and ty are meaningless and they should not be used. twidth and theight are still correct.
You can check if the display is on Wayland by screen-display-type.
On Cocoa, the result does not account for the size of the interface toolbar, if present in interface.
;; Define and display an interface. (capi:define-interface test () () (:panes (panel capi:list-panel))) (setq int (capi:display (make-instance 'test))) ;; Now manually position the interface somewhere. ;; Find where the interface is. (multiple-value-setq (tx ty twidth theight) (values-list (capi:apply-in-pane-process-wait-multiple int nil 'capi:top-level-interface-geometry int))) ;; Now manually close the interface. ;; Create a new interface in the same place. (setq int (capi:display (make-instance 'test :best-x tx :best-y ty :best-width twidth :best-height theight)))
top-level-interface-p
top-level-interface-display-state
set-top-level-interface-geometry
interface
4.3 Support for multiple monitors
7 Programming with CAPI Windows
11.6 Querying and modifying interface geometry
CAPI User Guide and Reference Manual (Macintosh version) - 18 Feb 2025 15:33:09