The single owner of server-side decoration (title-bar) state. More...
#include <phosphor-compositor/include/PhosphorCompositor/DecorationManager.h>
Classes | |
| struct | Owner |
| An owner is a (kind, screen) pair. More... | |
Public Types | |
| enum class | OwnerKind { Rule } |
| enum class | Placement { CallerWillPlace , AlreadyPlaced } |
| How the physical hide coordinates with geometry application. More... | |
Signals | |
| void | windowDecorationRestored (const QString &windowId) |
| Emitted after a physical decoration restore (the effect refreshes border overlays for the window). | |
Public Member Functions | |
| DecorationManager (ICompositorBridge &bridge, QObject *parent=nullptr) | |
bridge must outlive the manager (the KWin effect owns both, with the bridge destroyed after the manager). | |
| void | acquire (const QString &windowId, const Owner &owner, Placement placement=Placement::AlreadyPlaced) |
Low-level primitive: take ownership of windowId's decoration and hide it per placement. | |
| void | restoreAll () |
| Daemon loss / effect teardown: synchronously restore every window we hid to its prior state, then drop all tracking. | |
| void | forgetWindow (const QString &windowId) |
| Window destroyed: drop all state for it. | |
| void | setRuleOverride (const QString &windowId, std::optional< bool > ruleValue) |
| nullopt: rule has no opinion — clear Rule owner and veto. | |
| void | clearAllRuleOverrides () |
| Rules went away wholesale (rule set emptied / teardown): clear every Rule owner and veto, restoring where no other owner remains. | |
| void | resyncWindow (const QString &windowId) |
| The compositor can silently reset noBorder (KWin does on desktop switches). | |
| bool | isBorderless (const QString &windowId) const |
| True when we physically suppressed the window's decoration. | |
| bool | isOwned (const QString &windowId) const |
| bool | isOwnedBy (const QString &windowId, const Owner &owner) const |
| bool | isVetoed (const QString &windowId) const |
Static Public Member Functions | |
| static Owner | rule () |
The single owner of server-side decoration (title-bar) state.
Every component that wants a window's title bar hidden registers as an OWNER here instead of calling setNoBorder() itself. The decoration is hidden while at least one owner holds the window (and no veto pins it visible) and restored to its prior state when the last owner releases. Title-bar hiding flows entirely through the window-rule layer (setRuleOverride / clearAllRuleOverrides); there is exactly one owner kind.
Invariants this class centralizes:
|
strong |
|
strong |
How the physical hide coordinates with geometry application.
|
explicit |
bridge must outlive the manager (the KWin effect owns both, with the bridge destroyed after the manager).
Taken by reference so a null bridge is unrepresentable — no runtime guard needed on any call path.
| void PhosphorCompositor::DecorationManager::acquire | ( | const QString & | windowId, |
| const Owner & | owner, | ||
| Placement | placement = Placement::AlreadyPlaced |
||
| ) |
Low-level primitive: take ownership of windowId's decoration and hide it per placement.
This is the public seam the higher-level setRuleOverride is built on (it calls acquire(.., rule(), AlreadyPlaced)). Placement::CallerWillPlace is provided for a caller that applies the zone geometry itself right after acquiring; the in-tree effect only ever uses AlreadyPlaced via setRuleOverride, so CallerWillPlace is currently exercised only by direct callers and tests. Kept public deliberately as the reusable primitive, not dead code.
| void PhosphorCompositor::DecorationManager::clearAllRuleOverrides | ( | ) |
Rules went away wholesale (rule set emptied / teardown): clear every Rule owner and veto, restoring where no other owner remains.
| void PhosphorCompositor::DecorationManager::forgetWindow | ( | const QString & | windowId | ) |
Window destroyed: drop all state for it.
Zero compositor calls — the decoration dies with the window.
| bool PhosphorCompositor::DecorationManager::isBorderless | ( | const QString & | windowId | ) | const |
True when we physically suppressed the window's decoration.
| bool PhosphorCompositor::DecorationManager::isOwned | ( | const QString & | windowId | ) | const |
| bool PhosphorCompositor::DecorationManager::isOwnedBy | ( | const QString & | windowId, |
| const Owner & | owner | ||
| ) | const |
| bool PhosphorCompositor::DecorationManager::isVetoed | ( | const QString & | windowId | ) | const |
| void PhosphorCompositor::DecorationManager::restoreAll | ( | ) |
Daemon loss / effect teardown: synchronously restore every window we hid to its prior state, then drop all tracking.
| void PhosphorCompositor::DecorationManager::resyncWindow | ( | const QString & | windowId | ) |
The compositor can silently reset noBorder (KWin does on desktop switches).
If windowId should be hidden but the decoration came back, re-hide via the AlreadyPlaced sequence. No-op otherwise.
|
inlinestatic |
| void PhosphorCompositor::DecorationManager::setRuleOverride | ( | const QString & | windowId, |
| std::optional< bool > | ruleValue | ||
| ) |
nullopt: rule has no opinion — clear Rule owner and veto.
true: rule hides — acquire a Rule owner (clears any veto). false: rule force-shows — VETO. The veto wins over every owner and pins the decoration visible; owners re-assert when it lifts.
|
signal |
Emitted after a physical decoration restore (the effect refreshes border overlays for the window).
Slots may synchronously re-enter the manager — including destroying it or calling restoreAll() — every emit site guards its epilogue accordingly.