All Manuals > CAPI User Guide and Reference Manual > 11 Defining Interface Classes - top level windows


11.6 Querying and modifying interface geometry

The functions screen-monitor-geometries, screen-internal-geometries and pane-screen-internal-geometry support the notions of monitor geometry (which includes "system" areas such as the Mac OS X menu bar and the Microsoft Windows task bar) and internal geometry (which excludes the system areas).

Note that code which relies on the position of a window should not assume that a window is located where it has just been programmatically displayed, but should query the current position by top-level-interface-geometry. This is because the geometry includes system areas where CAPI windows cannot be displayed.

11.6.1 Support for multiple monitors

CAPI supports multiple monitors by providing functions such as screen-internal-geometries to query "screen rectangles" representing the area of each monitor. The function virtual-screen-geometry returns a rectangle just enclosing all the screen rectangles.

There is a "primary monitor" which displays any system areas. The origin of the coordinate system (as returned by top-level-interface-geometry and screen-internal-geometry) is the topmost/leftmost visible pixel of the primary monitor. Thus (0,0) may be in a system area such as the Mac OS X menu bar.

Note also that CAPI does not currently support multiple desktops, which are called workspaces in Linux distros, and called Spaces on Mac OS X.

11.6.2 Saving and restoring top-level geometry

You can specify that that the geometry of a top level interface should be saved when the interface is closed and be used to define the geometry of the interface when it is opened again (potentially in a different invocation of the application). You need to define a method of top-level-interface-save-geometry-p that returns true for the interface class. You normally also need to specify where to save the geometry, using top-level-interface-geometry-key.


CAPI User Guide and Reference Manual (Windows version) - 3 Aug 2017