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 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 | restoreSavedModeFloat (const QString &windowId) |
| virtual void | clearSavedFloatingForWindows (const QStringList &windowIds) |
| Remove saved floating state for the given windows (per-window, not bulk clear). | |
| 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 | 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 | setCurrentActivity (const QString &activity) |
| 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 | clearAllSavedFloating () |
| virtual void | saveModeFloat (const QString &windowId) |
| virtual void | clearSavedModeFloating () |
| virtual QJsonArray | serializeWindowOrders () const |
| virtual void | deserializeWindowOrders (const QJsonArray &orders) |
| virtual QJsonObject | serializePendingRestores () const |
| virtual void | deserializePendingRestores (const QJsonObject &obj) |
| virtual void | setWindowRegistry (QObject *registry) |
| Attach a window-class registry (QObject carrying WindowRegistry). | |
| virtual void | setIsWindowFloatingFn (std::function< bool(const QString &)> fn) |
| 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 |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Remove saved floating state for the given windows (per-window, not bulk clear).
Reimplemented in PhosphorSnapEngine::SnapEngine, and PhosphorTileEngine::AutotileEngine.
|
inlinevirtual |
Reimplemented in PhosphorSnapEngine::SnapEngine.
|
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 |
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 |
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-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 |
Reimplemented in PhosphorSnapEngine::SnapEngine.
|
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.
|
inlinevirtual |
Reimplemented in PhosphorSnapEngine::SnapEngine.
|
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 |
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 |
| fn | Callback; must remain valid for this engine's lifetime. |
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 (e.g., SnapEngine before PR 2). 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.