Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
Phosphor::Screens::IPanelSource Class Referenceabstract

Pluggable producer of panel-reservation offsets per screen. More...

#include <phosphor-screens/include/PhosphorScreens/IPanelSource.h>

Inheritance diagram for Phosphor::Screens::IPanelSource:
[legend]

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.
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ IPanelSource()

Phosphor::Screens::IPanelSource::IPanelSource ( QObject *  parent = nullptr)
inlineexplicit

◆ ~IPanelSource()

Phosphor::Screens::IPanelSource::~IPanelSource ( )
overridedefault

Member Function Documentation

◆ currentOffsets()

virtual Offsets Phosphor::Screens::IPanelSource::currentOffsets ( QScreen *  screen) const
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.

◆ panelOffsetsChanged

void Phosphor::Screens::IPanelSource::panelOffsetsChanged ( QScreen *  screen)
signal

Offsets for screen changed.

Emit only when the new values differ from the last known values (no spam on repeat queries).

◆ ready()

virtual bool Phosphor::Screens::IPanelSource::ready ( ) const
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.

◆ requeryCompleted

void Phosphor::Screens::IPanelSource::requeryCompleted ( )
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.

◆ requestRequery()

virtual void Phosphor::Screens::IPanelSource::requestRequery ( int  delayMs = 0)
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.

◆ start()

virtual void Phosphor::Screens::IPanelSource::start ( )
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.

◆ stop()

virtual void Phosphor::Screens::IPanelSource::stop ( )
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.


The documentation for this class was generated from the following file: