Unified placement engine interface. More...
#include <phosphor-engine/include/PhosphorEngine/IPlacementEngine.h>
Classes | |
| struct | HandoffContext |
| Context for a cross-engine window handoff. More... | |
Public Member Functions | |
| virtual | ~IPlacementEngine ()=default |
| virtual bool | isActiveOnScreen (const QString &screenId) const =0 |
| Whether this engine is active on the given screen. | |
| virtual void | windowOpened (const QString &windowId, const QString &screenId, int minWidth=0, int minHeight=0)=0 |
| A new window appeared on this engine's screen. | |
| void | windowOpened (const QString &windowId, const QString &screenId) |
| Convenience overload — equivalent to windowOpened(id, screen, 0, 0). | |
| virtual void | windowClosed (const QString &windowId)=0 |
| A window was closed. | |
| virtual void | windowFocused (const QString &windowId, const QString &screenId)=0 |
| A window gained focus (called when the compositor reports activation). | |
| virtual void | toggleWindowFloat (const QString &windowId, const QString &screenId)=0 |
| Toggle between managed and floating. | |
| virtual void | setWindowFloat (const QString &windowId, bool shouldFloat)=0 |
| Set floating state explicitly (directional, not toggle). | |
| virtual void | focusInDirection (const QString &direction, const NavigationContext &ctx)=0 |
| Move keyboard focus to the adjacent window. | |
| virtual void | moveFocusedInDirection (const QString &direction, const NavigationContext &ctx)=0 |
| Move the focused window to the adjacent slot. | |
| virtual void | swapFocusedInDirection (const QString &direction, const NavigationContext &ctx)=0 |
| Swap the focused window with the adjacent window. | |
| virtual void | moveFocusedToPosition (int position, const NavigationContext &ctx)=0 |
| Move the focused window to the Nth position. | |
| virtual void | rotateWindows (bool clockwise, const NavigationContext &ctx)=0 |
| Rotate all managed windows on the screen. | |
| virtual void | reapplyLayout (const NavigationContext &ctx)=0 |
| Re-apply the current layout to all managed windows. | |
| virtual void | snapAllWindows (const NavigationContext &ctx)=0 |
| Snap every unmanaged window on the screen to the current layout. | |
| virtual void | cycleFocus (bool forward, const NavigationContext &ctx)=0 |
| Cycle keyboard focus through managed windows. | |
| virtual void | pushToEmptyZone (const NavigationContext &ctx)=0 |
| Move the focused window to the first empty slot. | |
| virtual void | restoreFocusedWindow (const NavigationContext &ctx)=0 |
| Restore the focused window out of its managed state. | |
| virtual void | toggleFocusedFloat (const NavigationContext &ctx)=0 |
| Toggle the focused window between managed and floating. | |
| virtual QSet< QString > | activeScreens () const |
| virtual void | setActiveScreens (const QSet< QString > &screens) |
| virtual void | reapplyManagedWindowAppearance () |
| Re-drive the compositor's per-window appearance (border, hidden title bar) for every window this engine currently manages, WITHOUT recomputing the layout — windows keep their current zones/positions. | |
| virtual std::optional< WindowPlacement > | capturePlacement (const QString &windowId) const |
Report windowId's CURRENT placement for persistence, or nullopt if this engine does not manage it. | |
| virtual bool | restorePlacement (const WindowPlacement &placement, const QString &screenId) |
Apply placement to a (re)opening window on screenId. | |
| virtual QStringList | managedWindowOrder (const QString &screenId) const |
| virtual void | setInitialWindowOrder (const QString &screenId, const QStringList &windowIds) |
| virtual void | applyPerScreenConfig (const QString &screenId, const QVariantMap &overrides) |
| virtual void | clearPerScreenConfig (const QString &screenId) |
| virtual QVariantMap | perScreenOverrides (const QString &screenId) const |
| virtual bool | isModeSpecificFloated (const QString &windowId) const |
| virtual void | clearModeSpecificFloatMarker (const QString &windowId) |
| virtual bool | hasDragInsertPreview () const |
| virtual bool | beginDragInsertPreview (const QString &windowId, const QString &screenId) |
| virtual void | commitDragInsertPreview () |
| virtual void | cancelDragInsertPreview () |
| virtual QString | dragInsertPreviewScreenId () const |
| virtual bool | isWindowTracked (const QString &windowId) const |
| virtual bool | isWindowManaged (const QString &windowId) const |
| Whether the engine considers the window "managed" (eligible for layout operations). | |
| virtual bool | isWindowTiled (const QString &windowId) const |
| Whether the window is actively tiled (engine-owned, non-floating). | |
| virtual QString | screenForTrackedWindow (const QString &windowId) const |
| Return the screen this engine considers the window to be on, or empty if the window isn't tracked by this engine. | |
| virtual void | onWindowResized (const QString &windowId, const QRect &oldFrame, const QRect &newFrame, const QString &screenId) |
| Notify the engine that a tracked window finished an interactive resize. | |
| virtual void | handoffReceive (const HandoffContext &ctx) |
| Receive ownership of a window from another engine. | |
| virtual void | handoffRelease (const QString &windowId) |
| Release ownership of a window WITHOUT modifying its geometry. | |
| virtual QString | engineId () const |
| Stable engine identity for HandoffContext.fromEngineId. | |
| virtual int | computeDragInsertIndexAtPoint (const QString &screenId, const QPoint &cursorPos) const |
| Compute the insert index for a cursor position on a managed screen. | |
| virtual void | updateDragInsertPreview (int insertIndex) |
| Update the target insert index for an active drag-insert preview. | |
| virtual QString | algorithmId () const |
| virtual void | setAlgorithm (const QString &algorithmId) |
| virtual bool | isEnabled () const noexcept |
| virtual QString | activeScreen () const |
| virtual void | setActiveScreenHint (const QString &screenId) |
| virtual void | setCurrentDesktop (int desktop) |
| virtual void | setCurrentDesktopForScreen (const QString &screenId, int desktop) |
| Set a single screen's current virtual desktop (Plasma 6.7 "switch desktops
independently for each screen"). | |
| virtual void | clearCurrentDesktopForScreen (const QString &screenId) |
| Drop a screen's per-output desktop, reverting it to the global current. | |
| virtual void | setCurrentActivity (const QString &activity) |
| virtual void | setCrossSurfaceResolver (ICrossSurfaceResolver *resolver) |
| Inject the cross-surface resolver used to find a neighbouring output / desktop when directional navigation reaches a surface boundary. | |
| virtual void | updateStickyScreenPins (const std::function< bool(const QString &)> &isWindowSticky) |
| virtual QSet< int > | desktopsWithActiveState () const |
| virtual void | pruneStatesForDesktop (int removedDesktop) |
| virtual void | pruneStatesForActivities (const QStringList &validActivities) |
| virtual void | refreshConfigFromSettings () |
| Re-read all tuning values from the engine's settings interface. | |
| virtual qreal | effectiveSplitRatioStep (const QString &screenId) const |
| virtual int | runtimeMaxWindows () const |
| Runtime max-windows limit. | |
| virtual void | retile (const QString &screenId=QString()) |
| virtual void | scheduleRetileForScreen (const QString &screenId) |
| virtual void | markModeSpecificFloated (const QString &windowId) |
| virtual void | setWindowRegistry (QObject *registry) |
| Attach a window-class registry (QObject carrying WindowRegistry). | |
| virtual void | increaseMasterRatio (qreal delta=0.05) |
| virtual void | decreaseMasterRatio (qreal delta=0.05) |
| virtual void | increaseMasterCount () |
| virtual void | decreaseMasterCount () |
| virtual void | focusMaster () |
| virtual void | swapFocusedWithMaster () |
| virtual QJsonObject | serializeEngineState () const |
| virtual void | deserializeEngineState (const QJsonObject &state) |
| virtual void | saveState ()=0 |
| virtual void | loadState ()=0 |
| virtual IPlacementState * | stateForScreen (const QString &screenId)=0 |
| Per-screen state object for the given screen. | |
| virtual const IPlacementState * | stateForScreen (const QString &screenId) const =0 |
Unified placement engine interface.
Methods are divided into two categories:
REQUIRED (pure virtual, = 0): Every engine MUST implement these. They represent the core contract: screen ownership, window lifecycle, float management, and navigation intents.
OPTIONAL (have default no-op implementations): Engines override only the capabilities they support. A snap engine ignores master operations; an autotile engine ignores per-screen config. The defaults are safe no-ops so the daemon can call any method without branching on engine type.
Both snap-mode (manual zone layouts) and autotile-mode (automatic tiling algorithms) implement this so the daemon can dispatch all window lifecycle events and user navigation intents through a single polymorphic call — zero mode branches.
Each method represents a USER INTENT, not a mode-specific implementation step. "Move focused window left" has different internal meaning in tile-swap mode vs. zone-snap mode, but the user's request is the same — the interface names the request and each engine fulfills it in its own terms.
All methods are idempotent with respect to "no focused window" — each implementation emits navigation feedback with a sensible reason code when there's nothing to act on, rather than erroring out.
|
virtualdefault |
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Report windowId's CURRENT placement for persistence, or nullopt if this engine does not manage it.
Fill the engine's EngineSlot — state from its token vocabulary (free/floating/snapped/tiled/...) plus its slot reference (zone IDs / tile order) — under engines[engineId()], and the screen/desktop/ activity context. Do NOT set freeGeometryByScreen: the capture orchestrator fills the shared free/float geometry from the live frame, and only when the state is free/floating, so a managed rect never becomes the float-back.
This is the polymorphic capture seam the common layer drives — the WTA close hook and the save-time snapshot call it for every window.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Drop a screen's per-output desktop, reverting it to the global current.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Compute the insert index for a cursor position on a managed screen.
Returns -1 if the screen has no active state.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Cycle keyboard focus through managed windows.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Stable engine identity for HandoffContext.fromEngineId.
Conventional values: "snap" / "autotile". Empty string means "unidentified" and disables receive-side reasoning that depends on the source mode.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Move keyboard focus to the adjacent window.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Receive ownership of a window from another engine.
Implementations should:
windowFloatingChanged / placement signals their normal placement paths emit, so downstream state stays consistent.Default is a no-op so engines that don't yet implement the handoff don't reject the call — the orchestrator falls back to its legacy path.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Release ownership of a window WITHOUT modifying its geometry.
Implementations should:
Default is a no-op for the same reason as handoffReceive.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Whether this engine is active on the given screen.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtualnoexcept |
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Whether the engine considers the window "managed" (eligible for layout operations).
Semantics are engine-specific:
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Whether the window is actively tiled (engine-owned, non-floating).
Distinct from isWindowTracked (which includes floating windows).
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Move the focused window to the adjacent slot.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Move the focused window to the Nth position.
Implemented in PhosphorTileEngine::AutotileEngine, and PhosphorSnapEngine::SnapEngine.
|
inlinevirtual |
Notify the engine that a tracked window finished an interactive resize.
The daemon's WindowTracking adaptor forwards the compositor's interactive-resize-finished event here so an engine can reflow the rest of its layout to absorb the change (autotile fills the freed gap; GitHub #652). oldFrame / newFrame are the window's frame geometry before and after the resize; screenId is the screen the daemon resolved the window to. Default is a no-op for engines (e.g. snap) that have no neighbour-reflow model.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Move the focused window to the first empty slot.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Re-apply the current layout to all managed windows.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Re-drive the compositor's per-window appearance (border, hidden title bar) for every window this engine currently manages, WITHOUT recomputing the layout — windows keep their current zones/positions.
The compositor derives each window's chrome from the geometry/state this re-emits.
Called by the daemon when the compositor bridge (re)registers: on a daemon or effect restart the compositor drops its per-window appearance state, so it must be re-driven from the daemon's authoritative placement state. Distinct from reapplyLayout(), which is a user navigation action that recomputes the layout and may move windows. Default is a no-op for engines that don't manage compositor-side window chrome.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Re-read all tuning values from the engine's settings interface.
Called by the daemon after any settings change. Engines that cache config values (e.g. AutotileEngine) override this to repopulate their config struct. Engines that read on demand (e.g. SnapEngine) leave this as a no-op.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Restore the focused window out of its managed state.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Apply placement to a (re)opening window on screenId.
Return true if this engine claimed and applied it. Dispatch on placement.slotFor(engineId()) .state, reading the engine's slot reference and the shared freeGeometryByScreen.
Contract pair of capturePlacement() and the engine-agnostic entry point for a new engine. NOTE: the built-in snap and autotile engines do NOT route through this method — they apply restore inline in their own open paths (SnapEngine::resolveWindowRestore consults the store and returns a SnapResult to the effect; AutotileEngine::insertWindow take()s the record and inserts at position) because those paths carry engine-specific policy (snap's auto-snap fallback chain; autotile's burst-insert coalescing) that a single apply-this-record call cannot express. A minimal future engine may instead implement only this method and have its own open path invoke it directly.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Rotate all managed windows on the screen.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Runtime max-windows limit.
Returns -1 (unlimited sentinel) by default; engines that enforce a cap override with the actual value. Callers must treat -1 as "no limit" — never use as a divisor.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Return the screen this engine considers the window to be on, or empty if the window isn't tracked by this engine.
The daemon-side shortcut router consults this across engines to resolve the active window's current screen for routing decisions (float, focus, move). Without it, a cross-engine handoff (e.g. drag-insert from snap into autotile) leaves the daemon's screenAssignments lookup empty because the source engine has released its tracking, and the next shortcut routes to whichever engine the cached focus screen pointed at rather than the engine that now owns the window.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Inject the cross-surface resolver used to find a neighbouring output / desktop when directional navigation reaches a surface boundary.
The resolver is borrowed, not owned; the caller must keep it alive for the engine's lifetime (in the daemon it outlives both engines by member order). Engines that don't support cross-surface navigation ignore it.
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Set a single screen's current virtual desktop (Plasma 6.7 "switch desktops independently for each screen").
A PURE context swap — it selects which per-(screen, desktop) tiling state is current for this screen; it does NOT migrate windows between desktop states (the other desktop's state must stay put so it reappears when that screen returns). Default no-op for engines that are not per-screen-desktop-aware.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Set floating state explicitly (directional, not toggle).
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Attach a window-class registry (QObject carrying WindowRegistry).
Engines qobject_cast to their concrete type internally.
| registry | Not owned; must outlive this engine. |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Snap every unmanaged window on the screen to the current layout.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Per-screen state object for the given screen.
May return nullptr if the engine does not manage the screen OR if per-screen state ownership has not yet been wired for that engine. Callers must not use a non-null return as a proxy for "engine manages this screen" — use isActiveOnScreen() for that check.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Swap the focused window with the adjacent window.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Toggle the focused window between managed and floating.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
Toggle between managed and floating.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Update the target insert index for an active drag-insert preview.
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
pure virtual |
A window was closed.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
pure virtual |
A window gained focus (called when the compositor reports activation).
Named "focused" here because it's the engine's perspective; the D-Bus protocol and DaemonClient use "windowActivated" — same event.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inline |
Convenience overload — equivalent to windowOpened(id, screen, 0, 0).
|
pure virtual |
A new window appeared on this engine's screen.
Implemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.