Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/displays.h

The screens, and which one something is on.

#include <sonore/gfx/displays.h>
On this page

Design notes

Why this is not "the screen size"

Everything that places a popup asked the peer for screenSize(), which answered for the MAIN display. On a single monitor that is right. On two it is wrong in a specific and confusing way: a menu opened near the bottom of a second screen is checked against the first screen's height, decides it fits, and is drawn off the bottom of the monitor it is actually on. Worse on a monitor placed ABOVE or LEFT of the primary, where coordinates are NEGATIVE and a "does it fit on screen" test against 0..height fails for every point.

Producers use two monitors more than almost anyone.

Why the peers supply it

Enumerating displays is a platform call, and this header must compile with no platform at all -- sdk_tests has no window. So it is a list a peer fills in, with a sensible single-screen default, exactly like Clipboard.

Types 2

One screen.

NOTE: Xlib also typedefs a global Display, which is a CONNECTION rather than a monitor. Any file that says using namespace sonore::gfx and includes window_x11.h has to spell one of them out -- the same trap Font and Window already spring, and documented in window_x11.h's header for the same reason.

Every screen, as the peers last reported them.

A list rather than a query, because it is asked for on every popup and a platform call per menu is a round trip nobody needs -- and because a build with no window still has to answer something sensible.

↑↓ to move↵ to openEvery public name in the headers, and every guide