Resolve a global cursor position to the effective screen ID. More...
#include <phosphor-screens/include/PhosphorScreens/Resolver.h>
Public Types | |
| using | Endpoint = ResolverEndpoint |
Static Public Member Functions | |
| static QString | effectiveScreenAt (const QPoint &pos, const ResolverEndpoint &endpoint=ResolverEndpoint{}, int timeoutMs=PhosphorProtocol::Service::SyncCallTimeoutMs) |
| Resolve a screen coordinate to an effective screen ID. | |
| static QString | effectiveScreenAtCursor (const ResolverEndpoint &endpoint=ResolverEndpoint{}, int timeoutMs=PhosphorProtocol::Service::SyncCallTimeoutMs) |
Convenience wrapper: resolve at the current QCursor::pos(). | |
Resolve a global cursor position to the effective screen ID.
On a plain single-monitor setup "effective screen ID" is just the physical QScreen::name(). On multi-monitor or virtual-screen setups, a Phosphor daemon (or any compatible host) tracks a richer mapping (virtual-screen regions carved out of physical outputs, duplicate-connector disambiguation) that Qt itself doesn't know about — so we ask the daemon over D-Bus.
The resolver is a thin static-method facade over a single D-Bus call with a Qt-native fallback. No state, no lifetime; the caller decides which service / object / interface to ask.
|
static |
Resolve a screen coordinate to an effective screen ID.
Tries the daemon's virtual-screen-aware lookup first (skipped entirely if the daemon isn't already on the bus, so the call never triggers D-Bus auto-activation). Falls back to QGuiApplication::screenAt(pos), then to QGuiApplication::primaryScreen(). Returns an empty string only if Qt reports no screens at all (headless / test environments).
| pos | Position in global screen coordinates. |
| endpoint | D-Bus endpoint to query. Defaults to the PlasmaZones daemon. |
| timeoutMs | D-Bus call timeout in milliseconds. Keep this short — the caller is typically blocking the user's shortcut keypress. |
|
static |
Convenience wrapper: resolve at the current QCursor::pos().