Pluggable producer of panel-reservation offsets per screen. More...
#include <phosphor-screens/include/PhosphorScreens/IPanelSource.h>
Classes | |
| struct | Offsets |
| Per-edge reserved geometry, in physical pixels relative to the screen's top-left. More... | |
Signals | |
| void | panelOffsetsChanged (QScreen *screen) |
Offsets for screen changed. | |
| void | requeryCompleted () |
A requestRequery cycle completed. | |
Public Member Functions | |
| IPanelSource (QObject *parent=nullptr) | |
| ~IPanelSource () override=default | |
| virtual void | start ()=0 |
| Begin watching. | |
| virtual void | stop ()=0 |
| Stop watching. | |
| virtual Offsets | currentOffsets (QScreen *screen) const =0 |
| Snapshot for a given screen. | |
| virtual bool | ready () const =0 |
Has any successful query landed? Drives ScreenManager's panelGeometryReady one-shot signal — consumers that compute initial zone geometry at daemon startup gate on this so they don't lay out windows against the unreserved screen rect. | |
| virtual void | requestRequery (int delayMs=0)=0 |
| Best-effort: ask the backend to re-query immediately, optionally after a short delay (e.g. | |
Pluggable producer of panel-reservation offsets per screen.
Panels (taskbars, docks, status bars) reserve part of each screen's geometry. Different desktops report this differently: KDE Plasma exposes it via org.kde.plasmashell D-Bus, GNOME via org.gnome.Mutter, sway / Hyprland via wlr-foreign-toplevel, and so on. PhosphorScreens delegates the source-specific details to an IPanelSource so the manager core stays compositor-agnostic.
Implementations are owned by the consumer (typically the daemon). Lifetime: must outlive the ScreenManager that holds the pointer.
Threading: ScreenManager calls currentOffsets, ready, and requestRequery from the GUI thread; signals must be emitted on the GUI thread (use QMetaObject::invokeMethod(this, ..., Qt::QueuedConnection) if the implementation queries from a worker).
|
inlineexplicit |
|
overridedefault |
|
pure virtual |
Snapshot for a given screen.
Returns zero offsets if the source has no information for this screen yet.
Implemented in Phosphor::Screens::NoOpPanelSource, and Phosphor::Screens::PlasmaPanelSource.
|
signal |
Offsets for screen changed.
Emit only when the new values differ from the last known values (no spam on repeat queries).
|
pure virtual |
Has any successful query landed? Drives ScreenManager's panelGeometryReady one-shot signal — consumers that compute initial zone geometry at daemon startup gate on this so they don't lay out windows against the unreserved screen rect.
Latch semantics: implementations MAY keep ready() returning true across stop / start cycles — the contract is "panels
have been queried successfully at least once", not "a fresh query
has completed since the last start". Consumers that need a liveness indicator should listen for requeryCompleted after their own requestRequery, rather than polling ready().
Implemented in Phosphor::Screens::NoOpPanelSource, and Phosphor::Screens::PlasmaPanelSource.
|
signal |
A requestRequery cycle completed.
Forwarded by ScreenManager as delayedPanelRequeryCompleted. Always fires at most once per requestRequery call, even if the underlying query coalesces with one already in flight.
|
pure virtual |
Best-effort: ask the backend to re-query immediately, optionally after a short delay (e.g.
to let a panel-editor UI close fully before settling). Implementations that don't support push-style refresh can no-op; requeryCompleted is still expected to fire at most once per call so callers can chain UI updates.
Implemented in Phosphor::Screens::NoOpPanelSource, and Phosphor::Screens::PlasmaPanelSource.
|
pure virtual |
Begin watching.
Implementations may emit panelOffsetsChanged any time after this returns; ScreenManager reads currentOffsets on each emission to refresh its cache.
Implemented in Phosphor::Screens::NoOpPanelSource, and Phosphor::Screens::PlasmaPanelSource.
|
pure virtual |
Stop watching.
Subsequent currentOffsets queries should still return the last-known values; only the change channel is closed.
Implemented in Phosphor::Screens::NoOpPanelSource, and Phosphor::Screens::PlasmaPanelSource.