Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorTileEngine::AutotileEngine Class Reference

Core engine for automatic window tiling. More...

#include <PhosphorTileEngine/AutotileEngine.h>

Inheritance diagram for PhosphorTileEngine::AutotileEngine:
[legend]

Public Types

using RestorePositionPredicate = std::function<bool(const QString& windowId, const QString& screenIdHint)>
 Predicate consulted on reopen to decide whether a FLOATED (untiled) window should have its previous global position re-applied.
using FloatPredicate = std::function<bool(const QString& windowId, const QString& screenId)>
 Predicate deciding whether an opening window should start FLOATING because a "Float this app" rule matched it.
using ContextTilesResolver = std::function<bool(const QString& screenId, int desktop, const QString& activity)>
 Whether a (screenId, desktop, activity) context tiles, as the daemon resolves it (feature switch, disabled cascade, autotile:none).
Public Types inherited from PhosphorEngine::IPlacementEngine
enum class  LayoutSupport { None , Placement , Templates }
 How this engine relates to user-selectable layouts — the entries the layout picker, drag layout popup, quick-layout slots and layout cycle operate on. More...

Signals

void enabledChanged (bool enabled)
 Emitted when the enabled state changes.
void autotileScreensChanged (const QStringList &screenIds, bool isDesktopSwitch)
 Emitted when the set of autotile screens changes.
void windowsTiled (const QString &tileRequestsJson)
 Emitted when windows are tiled to new geometries (batch).
Signals inherited from PhosphorEngine::PlacementEngineBase
void geometryRestoreRequested (const QString &windowId, const QRect &geometry, const QString &screenId)
void sizeRestoreRequested (const QString &windowId, const QSize &size, const QString &screenId)
 Resize windowId to size where it stands, leaving the position to the compositor.
void navigationFeedback (bool success, const QString &action, const QString &reason, const QString &sourceId, const QString &targetId, const QString &screenId)
void windowFloatingChanged (const QString &windowId, bool floating, const QString &screenId)
void activateWindowRequested (const QString &windowId)
void windowDesktopMoveRequested (const QString &windowId, int desktop)
 Emitted when directional navigation moves a window across virtual desktops: the engine has already re-keyed its own tiling state, and the compositor must move the real window to desktop (1-based).
void windowOutputMoveExpected (const QString &windowId, const QString &targetScreenId)
 Emitted when daemon-initiated directional navigation moves a window across physical outputs: the engine has already migrated its own tiling state (removed from the source key, re-added on targetScreenId) and scheduled both reflows.
void crossModeMoveRequested (const QString &windowId, const QString &targetScreenId, int targetDesktop, const QString &direction)
 Emitted when a directional MOVE reaches a context boundary whose target is a DIFFERENT tiling mode than the source — the source engine cannot place the window itself (it has no state for the other mode), so it defers to the daemon.
void crossModeSwapRequested (const QString &windowId, const QString &targetScreenId, int targetDesktop, const QString &direction)
 Emitted when a directional SWAP reaches a context boundary whose target is a DIFFERENT tiling mode than the source — the two-way cross-mode exchange.
void crossModeFocusRequested (const QString &targetScreenId, const QString &direction, bool *handled)
 Emitted when a directional FOCUS reaches a monitor boundary whose neighbour context runs a DIFFERENT tiling mode — the source engine cannot name that surface's entry-edge window (it holds no state for the other mode), so it defers to the daemon, which asks the target engine for the window facing the source in direction and activates it.
void windowFloatingStateSynced (const QString &windowId, bool floating, const QString &screenId)
 Emitted to sync floating state without restoring geometry: engine-internal divergence correction, an engine-initiated float (rules, oversize, the compositor's own-fullscreen hold), and a release-time clear, which carries an EMPTY screenId.
void windowsBatchFloated (const QStringList &windowIds, const QString &screenId)
 Emitted when overflow windows are batch-floated during applyTiling.
void algorithmChanged (const QString &algorithmId)
 Emitted when the active tiling algorithm changes.
void placementChanged (const QString &screenId)
 Emitted when the placement layout changes for a screen.
void windowsReleased (const QStringList &windowIds, const QSet< QString > &releasedScreenIds)
 Emitted when windows are released from engine management.
void settingsPersistRequested ()
 Emitted when the engine writes tuning values back to the settings object and wants the daemon to persist them to disk.

Public Member Functions

 AutotileEngine (PhosphorZones::LayoutRegistry *layoutManager, PhosphorEngine::IWindowTrackingService *windowTracker, PhosphorScreens::ScreenManager *screenManager, PhosphorTiles::ITileAlgorithmRegistry *algorithmRegistry, QObject *parent=nullptr)
 ~AutotileEngine () override
PhosphorTiles::ITileAlgorithmRegistry * algorithmRegistry () const
 The injected tile-algorithm registry. Borrowed — owner outlives the engine.
void setWindowRegistry (QObject *registry) override
 Wire up the shared WindowRegistry.
bool isEnabled () const noexcept override
 Check if any screen has autotile enabled.
QSet< int > desktopsWithActiveState () const override
 The virtual-desktop numbers any per-context entry names: a state, a parked context, a tuned flag, a stashed bag or a dirty memo.
bool isAutotileScreen (const QString &screenId) const
 Check if a specific screen uses autotile.
bool isWindowTracked (const QString &windowId) const override
 Check if a window is currently tracked in any autotile state.
bool isWindowTiled (const QString &rawWindowId) const override
 Check if a window is currently tiled (tracked AND not floating).
bool isWindowFloatingInAutotile (const QString &windowId) const
 Authoritative per-window autotile float state.
QStringList allFloatingWindows () const
 All windows currently floating in autotile across every tracked state.
bool isActiveOnScreen (const QString &screenId) const override
 Whether this engine is active on the given screen.
QSet< QString > activeScreens () const override
void setActiveScreens (const QSet< QString > &screens) override
QStringList managedWindowOrder (const QString &screenId) const override
 Capture-on-leave order: the tiled order PLUS minimize-floated windows at their windowOrder positions.
QStringList capturedWindowOrder (const QString &screenId) const
QString managedFocusedWindow (const QString &screenId) const override
 Capture half only.
int stickyPinnedDesktopForScreen (const QString &screenId) const override
 The desktop this engine has pinned this screen to, or 0.
bool isModeSpecificFloated (const QString &windowId) const override
void clearModeSpecificFloatMarker (const QString &windowId) override
bool isWindowManaged (const QString &windowId) const override
 Whether the engine considers the window "managed" (eligible for layout operations).
QString algorithmId () const override
void markModeSpecificFloated (const QString &windowId) override
const QSet< QString > & autotileScreens () const
 Get the set of screens currently using autotile.
QString activeScreen () const override
 Get the last-focused screen (updated by onWindowFocused).
void setAutotileScreens (const QSet< QString > &screens)
 Set which screens use autotile (derived from layout assignments).
void setCurrentDesktop (int desktop) override
 Set the current virtual desktop for per-desktop tiling state.
void setCurrentDesktopForScreen (const QString &screenId, int desktop) override
 Set a single screen's current virtual desktop (Plasma 6.7 per-output virtual desktops, #648).
void clearCurrentDesktopForScreen (const QString &screenId) override
 Drop a screen's per-output desktop, reverting it to m_context's global desktop.
void setCrossSurfaceResolver (PhosphorEngine::ICrossSurfaceResolver *resolver) override
 Inject the cross-surface resolver (neighbouring output / desktop lookup) used by directional navigation when it reaches a layout boundary.
void setCurrentActivity (const QString &activity) override
 Set the current activity for per-activity tiling state.
void updateStickyScreenPins (const PhosphorEngine::StickyPredicate &, PhosphorEngine::StickyPinPhase) override
 Pin screens where all autotiled windows are sticky (on all desktops).
PhosphorEngine::MembershipReconcileResult reconcileDesktopMemberships (const QString &screenId, const PhosphorEngine::DesktopSpanQuery &spanOf) override
 Give a window a tile on every desktop it occupies.
PhosphorEngine::MembershipReconcileResult reconcileWindowMemberships (const QString &windowId, const PhosphorEngine::DesktopSpanQuery &spanOf) override
 The same pass for ONE window, on the screen it is held on.
void pruneStatesForDesktop (int removedDesktop) override
 Prune every TilingState of removedDesktop, releasing its windows.
void renumberDesktopsAfterRemoval (int removedDesktop) override
 Shift every per-(screen, desktop, activity) state ABOVE removedDesktop down by one, because Plasma renumbers x11 desktop numbers when a desktop in the middle is deleted (removing 2 of 4 makes 3 become 2 and 4 become 3).
void remapDesktops (const PhosphorEngine::DesktopRemap &remap) override
 OPTIONAL: KWin's desktop list changed (a removal, an insert or a reorder).
void pruneStatesForActivities (const QStringList &validActivities) override
 Prune PhosphorTiles::TilingState entries for activities not in the given set.
void pruneStatesForRemovedScreen (const QString &physicalScreenId) override
 Prune PhosphorTiles::TilingState entries for a permanently removed monitor.
int currentDesktop () const noexcept
 Get the current virtual desktop tracked by the engine.
const QString & currentActivity () const noexcept
 Get the current activity tracked by the engine.
QString algorithm () const noexcept
 Get current algorithm ID.
void setAlgorithm (const QString &algorithmId) override
 Set the tiling algorithm.
PhosphorTiles::TilingAlgorithm * currentAlgorithm () const
 Get the current algorithm instance.
PhosphorTiles::TilingState * tilingStateForScreen (const QString &screenId)
 Get the tiling state for a specific screen.
PhosphorEngine::IPlacementState * stateForScreen (const QString &screenId) override
 Per-screen state object for the given screen.
const PhosphorEngine::IPlacementState * stateForScreen (const QString &screenId) const override
AutotileConfig * config () const noexcept
 Get the autotile configuration.
void saveState () override
 Save tiling state via persistence delegate (IPlacementEngine contract).
void loadState () override
 Load tiling state via persistence delegate (IPlacementEngine contract).
void setPersistenceDelegate (std::function< void()> saveFn, std::function< void()> loadFn)
 Set persistence callbacks for save/load.
void setRestorePositionPredicate (RestorePositionPredicate predicate)
 Inject the floated-position-restore gate.
void setFloatPredicate (FloatPredicate predicate)
LayoutSupport layoutSupport () const override
 Autotile algorithms appear as cards in the layout picker / quick slots, so this engine is a placement-layout consumer too.
QString engineId () const override
 Stable engine identity for HandoffContext.fromEngineId.
void handoffReceive (const HandoffContext &ctx) override
 Receive ownership of a window from another engine.
void handoffRelease (const QString &windowId) override
 Release ownership of a window WITHOUT modifying its geometry.
QString screenForTrackedWindow (const QString &windowId) const override
 Return the screen this engine considers the window to be on (any context), or empty if the window isn't tracked by this engine.
void onWindowResized (const QString &rawWindowId, const QRect &oldFrame, const QRect &newFrame, const QString &screenId) override
 Reflow neighbors after a window was interactively resized.
PhosphorEngine::IAutotileSettings * autotileSettings () const
void writeBackTuning ()
void refreshConfigFromSettings () override
 Re-read all tuning values from the engine's settings interface.
void applyPerScreenConfig (const QString &screenId, const QVariantMap &overrides) override
void clearPerScreenConfig (const QString &screenId) override
QVariantMap perScreenOverrides (const QString &screenId) const override
bool hasPerScreenOverride (const QString &screenId, const QString &key) const
void updatePerScreenOverride (const QString &screenId, const QString &key, const QVariant &value)
void setContextGapProvider (std::function< QVariantMap(const QString &screenId)> provider)
void setContextModeResolver (ContextTilesResolver resolver)
void setScrollingModeResolver (std::function< bool(const QString &screenId, int desktop, const QString &activity)> resolver)
 INERT, kept for ABI: a scrolling-mode resolver that fed windowOpened's cross-screen tile-restore defer, which the reopen contract removed (a window opening on an autotile screen is autotile's).
void noteSplitRatioUserTuned (const QString &screenId)
void noteMasterCountUserTuned (const QString &screenId)
int effectiveInnerGap (const QString &screenId) const
::PhosphorLayout::EdgeGaps effectiveOuterGaps (const QString &screenId) const
bool effectiveSmartGaps (const QString &screenId) const
bool effectiveRespectMinimumSize (const QString &screenId) const
int effectiveMaxWindows (const QString &screenId) const
PhosphorTiles::AutotileInsertPosition effectiveInsertPosition (const QString &screenId) const
qreal effectiveSplitRatioStep (const QString &screenId) const override
int runtimeMaxWindows () const override
 Runtime max-windows limit.
std::optional< int > savedMaxWindowsForAlgorithm (const QString &algorithmId) const override
 The user's saved per-algorithm max-windows tuning, if any.
QString effectiveAlgorithmId (const QString &screenId) const
PhosphorTiles::TilingAlgorithm * effectiveAlgorithm (const QString &screenId) const
void clearScreenScheduling (const QString &screenId)
 Drop every per-screen SCHEDULING entry for screenId: pending retiles, retile retry state, and the deferred post-retile focus.
void clearPendingInitialOrder (const QString &screenId)
 Drop a screen's initial-order seed: the order, its generation counter and its strict marker, which only ever live or die together.
void purgeFromPendingOrders (const QString &windowId)
 Purge windowId from every pending initial order, with full bookkeeping: empty orders drop their generation/strict entries, and surviving orders are re-checked for resolution.
void notifyAlgorithmWindowAdded (PhosphorTiles::TilingState *state, const QString &screenId, const QString &windowId)
 Run the algorithm's onWindowAdded lifecycle hook for a just-inserted window.
void requestPostRetileFocus (const QString &screenId, const QString &windowId)
 Request that a window is activated after the given screen's next applyTiling.
void setInnerGap (int gap)
void setOuterGap (int gap)
void setSmartGaps (bool enabled)
void setFocusNewWindows (bool enabled)
void retile (const QString &screenId=QString()) override
 Force retiling of windows.
void swapWindows (const QString &windowId1, const QString &windowId2)
 Swap positions of two tiled windows.
void promoteToMaster (const QString &windowId)
 Promote a window to the master area.
void demoteFromMaster (const QString &windowId)
 Demote a window from the master area.
void swapFocusedWithMaster () override
 Swap the currently focused window with the master window.
void focusNext ()
 Focus the next tiled window.
void focusPrevious ()
 Focus the previous tiled window.
void focusMaster () override
 Focus the master window.
void setFocusedWindow (const QString &windowId)
 Notify the engine that a window has been focused.
void setActiveScreenHint (const QString &screenId) override
 Set the active screen hint for keyboard shortcut handlers.
void increaseMasterRatio (qreal delta=kDefaultSplitRatioStep) override
 Increase the master area ratio.
void decreaseMasterRatio (qreal delta=kDefaultSplitRatioStep) override
 Decrease the master area ratio.
void setGlobalSplitRatio (qreal ratio)
 Set master ratio globally (config + every state, every desktop).
void setGlobalMasterCount (int count)
 Set master count globally (config + every state, every desktop).
void increaseMasterCount () override
 Increase the number of master windows.
void decreaseMasterCount () override
 Decrease the number of master windows.
void rotateWindowOrder (bool clockwise=true)
 Rotate all tiled windows by one position.
void toggleFocusedWindowFloat ()
 Toggle the focused window between tiled and floating states.
void switchFocusBetweenFloatingAndTiling (const QString &screenId) override
 Jump focus between the float layer and the tiled layout.
void toggleWindowFloat (const QString &windowId, const QString &screenId) override
 Toggle a specific window between tiled and floating states.
void swapFocusedInDirection (const QString &direction, const QString &action=QStringLiteral("move"))
 Swap the focused window with the adjacent window in tiling order.
void focusInDirection (const QString &direction, const QString &action=QStringLiteral("focus"))
 Focus the adjacent window in tiling order with OSD feedback.
void moveFocusedToPosition (int position)
 Move the focused window to a specific position in the tiling order.
void focusInDirection (const QString &direction, const PhosphorEngine::NavigationContext &ctx) override
 Move keyboard focus to the adjacent window.
void moveFocusedInDirection (const QString &direction, const PhosphorEngine::NavigationContext &ctx) override
 Move the focused window to the adjacent slot.
void spanFocusedInDirection (const QString &direction, const PhosphorEngine::NavigationContext &ctx) override
 Grow or shrink the focused window's zone span toward the direction: extend into the adjacent zone(s) when some exist beyond that edge, otherwise retract the opposite edge.
void swapFocusedInDirection (const QString &direction, const PhosphorEngine::NavigationContext &ctx) override
 Swap the focused window with the adjacent window.
void moveFocusedToPosition (int position, const PhosphorEngine::NavigationContext &ctx) override
 Move the focused window to the Nth position.
void rotateWindows (bool clockwise, const PhosphorEngine::NavigationContext &ctx) override
 Rotate all managed windows on the screen.
QString entryWindowForCrossing (const QString &screenId, const QString &direction) const
 Cross-mode swap support (queried by the daemon when THIS engine is the target): the tiled window at screenId's entry edge facing the source for a crossing arriving in direction — the swap partner.
int windowOrderIndexForWindow (const QString &screenId, const QString &windowId) const
 The RAW window-order index of windowId on screenId (current desktop; counts floats, matching TilingState::addWindow), or -1 when not present — lets the daemon land a swap counterpart in the same slot the departing window held when re-inserted via HandoffContext.insertIndex.
void reapplyLayout (const PhosphorEngine::NavigationContext &ctx) override
 Re-apply the current layout to all managed windows.
void reapplyManagedWindowAppearance () override
 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.
std::optional< PhosphorEngine::WindowPlacement > capturePlacement (const QString &windowId) const override
 Report windowId's CURRENT placement for persistence, or nullopt if this engine does not manage it.
std::optional< PhosphorEngine::WindowPlacement > capturePlacementForKey (const QString &windowId, const PhosphorEngine::TilingStateKey &key) const
 capturePlacement against ONE of the window's contexts rather than its primary.
void snapAllWindows (const PhosphorEngine::NavigationContext &ctx) override
 Bring every unmanaged window on the screen back under this engine's placement (zones for snap, the strip for scrolling).
void toggleFocusedFloat (const PhosphorEngine::NavigationContext &ctx) override
 Toggle the focused window between managed and floating.
void cycleFocus (bool forward, const PhosphorEngine::NavigationContext &ctx) override
 Cycle keyboard focus through managed windows.
void pushToEmptyZone (const PhosphorEngine::NavigationContext &ctx) override
 Move the focused window to the first empty slot.
void restoreFocusedWindow (const PhosphorEngine::NavigationContext &ctx) override
 Restore the focused window out of its managed state.
void rotateWindows (bool clockwise, const QString &screenId)
void setWindowFloat (const QString &windowId, bool shouldFloat, const QString &screenId=QString()) override
 Set the floating state of a specific window.
void floatWindow (const QString &windowId)
 Float a specific window by its ID (convenience forwarder).
void unfloatWindow (const QString &windowId)
 Unfloat a specific window by its ID (convenience forwarder).
void setInitialWindowOrder (const QString &screenId, const QStringList &windowIds) override
 Pre-seed initial window order for deterministic snapping → autotile transitions.
QStringList tiledWindowOrder (const QString &screenId) const
 Get the current tiled window order for a screen.
void windowOpened (const QString &windowId, const QString &screenId, int minWidth, int minHeight) override
 A new window appeared on this engine's screen.
bool claimCrossScreenReopen (const QString &windowId, const QString &openingScreenId, int minWidth, int minHeight) override
 The reopen claim (see IPlacementEngine for the contract): only a FIFO record on another virtual screen of the opening output, in autotile mode, for a window opening on an autotile screen; never a record on another monitor and never the window's own.
void noteCrossScreenClaimsExhausted (const QString &windowId, bool exhausted) override
 INERT, kept for ABI: fed the removed cross-screen defer gates.
QString heldScreenForWindow (const QString &windowId) const override
 OPTIONAL: the screen this engine genuinely HOLDS the window on IN THE SCREEN'S CURRENT CONTEXT — a MEMBERSHIP answer (tiled or engine-floating both count; a phantom reverse-map key does not), empty when the engine does not hold it or holds it only in a background context.
std::optional< PhosphorEngine::PlacementStateKey > heldKeyForWindow (const QString &windowId) const override
 The (screen, desktop, activity) key of the state that genuinely holds windowId, tiled or floating, in ANY context, or nullopt when none does.
QStringList parkOutput (const QString &physicalScreenId) override
 Copy every context of physicalScreenId (each of its virtual screens) into the park, before the prune drops them.
bool readoptParked (const QString &windowId, const QString &parkedPhysicalId, const QString &returnedPhysicalId) override
 Re-seat windowId's contexts parked under parkedPhysicalId on returnedPhysicalId as a re-statement (no focus, no last-used), each in its own (screen, desktop, activity): its virtual screen on the returned output (or the bare output), never the context in view.
void dropParked (const QString &windowId, const QString &physicalScreenId, int desktop, const QString &activity) override
 Forget windowId's parked contexts; an empty physicalScreenId, a desktop of 0 or an empty activity matches every one.
bool hasParked (const QString &windowId, const QString &physicalScreenId) const override
 Whether windowId has a context parked under physicalScreenId (any output when it is empty).
void windowMinSizeUpdated (const QString &windowId, int minWidth, int minHeight) override
 A window's minimum size changed after windowOpened (0 when unconstrained): retiles when it differs from the stored value.
QSize windowMinimumSize (const QString &windowId) const override
 The window's client-reported minimum size as last known by this engine, or an UNKNOWN answer when it has none.
void windowClosed (const QString &windowId) override
 Notify the engine that a window was closed.
void windowFocused (const QString &windowId, const QString &screenId) override
 Notify the engine that a window was focused.
void scheduleRetileForScreen (const QString &screenId) override
 Schedule a deferred retile for a screen.
bool beginDragInsertPreview (const QString &rawWindowId, const QString &screenId) override
 Begin a drag-insert preview on screenId, ADOPTING the window when necessary.
void updateDragInsertPreview (int insertIndex)
 Update the target insert index for the active drag preview.
void updateDragInsertPreview (const DragInsertTarget &target) override
 IPlacementEngine drop-target form: primary is the tiled-only insert index; secondary/newSlot are meaningless for a flat stack and ignored.
void commitDragInsertPreview () override
 Commit the active drag-insert preview.
void cancelDragInsertPreview (bool dragStillActive=false) override
 Cancel the active drag-insert preview, restoring the original order.
void setInteractiveDragWindow (const QString &windowId) override
 Mark windowId as under a compositor interactive move (IPlacementEngine contract).
int computeDragInsertIndexAtPoint (const QString &screenId, const QPoint &cursorPos) const
 Compute the insert index for a cursor position on an autotile screen.
DragInsertTarget computeDragInsertTargetAtPoint (const QString &screenId, const QPoint &cursorPos) const override
 IPlacementEngine drop-target form: wraps the flat index into DragInsertTarget::primary (invalid when the screen has no state).
bool hasDragInsertPreview () const override
 Query whether a drag-insert preview is currently active.
QString dragInsertPreviewWindowId () const
 Get the window ID of the active drag-insert preview, or empty.
QString dragInsertPreviewScreenId () const override
 Get the target screen ID of the active drag-insert preview, or empty.
QString dragInsertPreviewPriorScreenId () const override
 The screen the previewed window sat on before begin adopted it.
void retileAfterOperation (const QString &screenId, bool operationSucceeded)
 Helper to retile a screen after a window operation.
void markAutotileFloated (const QString &rawWindowId)
void clearAutotileFloated (const QString &rawWindowId)
bool isAutotileFloated (const QString &rawWindowId) const
int pruneStaleWindows (const QSet< QString > &aliveWindowIds) override
 Drop any per-engine bookkeeping for windows not in aliveWindowIds.
QRect lastManagedRect (const QString &rawWindowId) const override
 The tile rect this engine last emitted for rawWindowId via applyTiling, remembered PAST the window's transition out of the tiled state (see the base doc: on a float toggle the tiled bit clears before the compositor repositions the window, and the capture orchestrator needs this rect to recognise the still-tiled live frame).
Public Member Functions inherited from PhosphorEngine::PlacementEngineBase
void setEngineSettings (QObject *settings)
QObject * engineSettings () const
 ~PlacementEngineBase () override
void setOpenFocusEligible (bool eligible) override
 OPTIONAL: whether the opens dispatched next may take focus ("Focus new windows"): true for a genuine open, false for a re-placement.
void releaseWindowOffScreen (const QString &windowId, const QString &keepScreenId) override
 A window is held on one output, so a hold on any screen but keepScreenId is released whole through handoffRelease (every context plus the durable slot), which never reaches the snap engine.
Public Member Functions inherited from PhosphorEngine::IPlacementEngine
virtual ~IPlacementEngine ()=default
 IPlacementEngine (const IPlacementEngine &)=delete
IPlacementEngine & operator= (const IPlacementEngine &)=delete
void windowOpened (const QString &windowId, const QString &screenId)
 Convenience overload — equivalent to windowOpened(id, screen, 0, 0).
virtual void beginArrivalBurst ()
 Bracket a BURST of windowOpened calls delivered together (the adaptor's three dispatch loops: windowsOpenedBatch, the deferred-open flush, and the parked-open replay — daemon bring-up re-announce and mode flips; a reopen claim's re-entry inherits the loop's bracket, while the snap facade's is deliberately UNBRACKETED since each resolveWindowRestore is its own D-Bus message).
virtual void endArrivalBurst ()
virtual bool restorePlacement (const WindowPlacement &placement, const QString &screenId)
 Apply placement to a (re)opening window on screenId.
virtual void setInitialFocusedWindow (const QString &screenId, const QString &windowId)
 Hand the incoming engine the focus captured from the outgoing one.
virtual bool dragAutoScrollTick (const QString &screenId, const QPoint &cursorPos, qreal dtSeconds)
 Advance edge auto-scroll for a live drag-insert preview (niri's dnd-edge-view-scroll): an engine whose layout is a scrollable viewport moves its VIEW while the cursor sits inside a band at the work area's edge, so a drop can reach a column that is off screen.
virtual bool dragAutoScrollActive () const
 Whether edge auto-scroll currently owns the drop target.
virtual void cancelDragAutoScroll ()
 Give the drop target back and forget any armed band, WITHOUT moving the view or re-aiming.
virtual QRect dragInsertIndicatorRect (const QString &screenId) const
 The rect the dragged window would occupy if the live preview were dropped now, in absolute px on screenId, for a caller that PAINTS the drop target.
virtual bool providesDragInsertSelector () const
 Whether the daemon's edge-triggered drag popup (the zone selector surface) should render this engine's DRAG-INSERT vocabulary — strip column cards whose gap / join / half targets translate into DragInsertTarget — instead of zone layouts, on screens this engine owns.
virtual void setDragInsertClientSize (const QSize &size)
 OPTIONAL: the size the client chose for the window under the live drag-insert preview, handed over right after a successful beginDragInsertPreview so the drop indicator and the commit both see it.

Additional Inherited Members

Static Public Attributes inherited from PhosphorEngine::IPlacementEngine
static constexpr qreal kDefaultSplitRatioStep = 0.05
 One home for the master/split ratio step so the default return below and the two default arguments cannot drift apart.
Protected Member Functions inherited from PhosphorEngine::PlacementEngineBase
 PlacementEngineBase (QObject *parent=nullptr)
bool openFocusEligible () const
 Whether the open being handled may take focus (see IPlacementEngine::setOpenFocusEligible).
void announceLayerSwitch (const LayerSwitchResult &result, const QString &action, const QString &screenId)
 Emit the activation + navigationFeedback pair for a resolved layer focus switch (resolveLayerFocusSwitch).
void restoreFreeSizeWhereItStands (IWindowTrackingService *tracker, const QString &windowId, const QString &screenId, RestoreReason reason, bool placedBefore, const QList< QSize > &managedSizes)
 The size-only half of a float verdict, shared by every engine (#1106).
Protected Member Functions inherited from PhosphorEngine::IPlacementEngine
 IPlacementEngine ()=default
Static Protected Member Functions inherited from PhosphorEngine::PlacementEngineBase
static bool isManagedSize (const QList< QSize > &managedSizes, const QSize &size)
 Whether size is within two pixels of any entry of managedSizes on both axes.
static bool placedByPreviousLineage (const WindowPlacementStore &store, const QString &windowId)
 The placedBefore snapshot for restoreFreeSizeWhereItStands: store holds a record WITH AN ENGINE SLOT under this exact uuid, so a previous daemon lineage placed the window (a daemon-only restart or mode-swap re-announce).

Detailed Description

Core engine for automatic window tiling.

Coordinates per-screen PhosphorTiles::TilingState, invokes the active tiling algorithm (a Luau script, via the PhosphorTiles::TilingAlgorithm interface), and applies calculated zone geometries to window positions. Only tiles windows on screens where autotiling is enabled.

See also
PhosphorTiles::TilingAlgorithm, PhosphorTiles::TilingState, PhosphorTiles::AlgorithmRegistry

Member Typedef Documentation

◆ ContextTilesResolver

using PhosphorTileEngine::AutotileEngine::ContextTilesResolver = std::function<bool(const QString& screenId, int desktop, const QString& activity)>

Whether a (screenId, desktop, activity) context tiles, as the daemon resolves it (feature switch, disabled cascade, autotile:none).

Read through contextRunsAutotile for a context its screen does not show, where isAutotileScreen cannot answer: readoptParked seats or grants a parked context only when it does (F1137), and handoffReceive takes an arrival for a background context (a refused handoff's re-home) only when it does (C101). Unset, the raw assignment decides, and with no layout manager either, every context tiles. A bool keeps the zones-layer mode type out of this header. Clear with {} at teardown.

◆ FloatPredicate

using PhosphorTileEngine::AutotileEngine::FloatPredicate = std::function<bool(const QString& windowId, const QString& screenId)>

Predicate deciding whether an opening window should start FLOATING because a "Float this app" rule matched it.

Daemon-injected, keyed by the live windowId. The window is still inserted (so it stays managed and Meta+F can re-tile it); it is just marked floating, identical to a manual float. When UNSET (default) no window is rule-floated. Clear with {} before destroying any state the closure captured.

screenIdHint carries the same contract as RestorePositionPredicate's: the screen the window is being inserted onto, which pins the daemon's ScreenId / ActiveLayout stamp past its resolver's snap-first precedence and past the consults that run before this engine keys the window. Takes the OPENING SCREEN as well, so the resolver can stamp ScreenId and derive Mode — without which a rule pairing either with Float is silently inert.

◆ RestorePositionPredicate

using PhosphorTileEngine::AutotileEngine::RestorePositionPredicate = std::function<bool(const QString& windowId, const QString& screenIdHint)>

Predicate consulted on reopen to decide whether a FLOATED (untiled) window should have its previous global position re-applied.

Mirrors SnapEngine::RestorePositionPredicate: the daemon resolves the global autotileRestoreFloatedWindowsOnLogin setting plus the per-window RestorePosition rule and injects the result here, keyed by the live windowId. The float STATE is always restored (the window comes back floating); only the geometry MOVE is gated. When UNSET (default), the engine preserves its historical behaviour of always re-applying the recorded position — the path unit tests rely on.

screenIdHint names the screen the window is being inserted onto. The daemon stamps its rule query's ScreenId / ActiveLayout context from it. The hint is needed because the daemon's own resolver consults the service and the snap engine BEFORE this engine, so a window carrying stale snap state would resolve to the snap screen rather than the landing screen, and some consults run before this engine has keyed the window at all. Empty is legal and means "ask the daemon's own fallbacks" for an already-tracked window.

Constructor & Destructor Documentation

◆ AutotileEngine()

PhosphorTileEngine::AutotileEngine::AutotileEngine ( PhosphorZones::LayoutRegistry * layoutManager,
PhosphorEngine::IWindowTrackingService * windowTracker,
PhosphorScreens::ScreenManager * screenManager,
PhosphorTiles::ITileAlgorithmRegistry * algorithmRegistry,
QObject * parent = nullptr )
explicit

◆ ~AutotileEngine()

PhosphorTileEngine::AutotileEngine::~AutotileEngine ( )
override

Member Function Documentation

◆ activeScreen()

QString PhosphorTileEngine::AutotileEngine::activeScreen ( ) const
inlineoverridevirtual

Get the last-focused screen (updated by onWindowFocused).

Returns
Screen ID of the most recently focused screen, or empty string

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ activeScreens()

QSet< QString > PhosphorTileEngine::AutotileEngine::activeScreens ( ) const
inlineoverridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ algorithm()

QString PhosphorTileEngine::AutotileEngine::algorithm ( ) const
noexcept

Get current algorithm ID.

Returns
Algorithm identifier (e.g., "master-stack")

◆ algorithmId()

QString PhosphorTileEngine::AutotileEngine::algorithmId ( ) const
inlineoverridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ algorithmRegistry()

PhosphorTiles::ITileAlgorithmRegistry * PhosphorTileEngine::AutotileEngine::algorithmRegistry ( ) const
inline

The injected tile-algorithm registry. Borrowed — owner outlives the engine.

◆ allFloatingWindows()

QStringList PhosphorTileEngine::AutotileEngine::allFloatingWindows ( ) const

All windows currently floating in autotile across every tracked state.

Used by the daemon's WTS floating-windows aggregator so the engine-agnostic floatingWindows() enumeration (effect float-cache seed, getAllWindowStates) still sees autotile floats now that they live in TilingState rather than the old shared WTS set.

◆ applyPerScreenConfig()

void PhosphorTileEngine::AutotileEngine::applyPerScreenConfig ( const QString & screenId,
const QVariantMap & overrides )
overridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ autotileScreens()

const QSet< QString > & PhosphorTileEngine::AutotileEngine::autotileScreens ( ) const
inline

Get the set of screens currently using autotile.

Returns
Set of screen names with autotile assignments

◆ autotileScreensChanged

void PhosphorTileEngine::AutotileEngine::autotileScreensChanged ( const QStringList & screenIds,
bool isDesktopSwitch )
signal

Emitted when the set of autotile screens changes.

Also RE-EMITTED with an unchanged set on a desktop/activity switch between two contexts whose autotile sets are identical (with isDesktopSwitch=true, discussion #219) — a wire-contract wakeup for the compositor effect's catch-scan, not a set change. Receivers must be idempotent for the same-set case.

Parameters
screenIdsList of screen IDs using autotile
isDesktopSwitchTrue if caused by desktop/activity switch (not user toggle)

◆ autotileSettings()

PhosphorEngine::IAutotileSettings * PhosphorTileEngine::AutotileEngine::autotileSettings ( ) const

◆ beginDragInsertPreview()

bool PhosphorTileEngine::AutotileEngine::beginDragInsertPreview ( const QString & rawWindowId,
const QString & screenId )
overridevirtual

Begin a drag-insert preview on screenId, ADOPTING the window when necessary.

Handles four entry modes, not just "already tiled here": a window tracked on a DIFFERENT screen is migrated in (its prior state is cleaned and the source screen retiled), a FLOATING window on the same screen is unfloated in place (overflow mark cleared), and a wholly UNTRACKED window is adopted fresh. When adoption pushes past effectiveMaxWindows, the last tiled neighbour is EVICTED by floating (commit reports it via windowsBatchFloated). Callers that must not adopt (e.g. "floating windows drag free") gate on isWindowTiled themselves — the daemon's reorder seed does exactly that.

Captures the window's prior position so cancel can restore it. While a preview is active, applyTiling() skips emitting geometry for the dragged window — KWin's interactive move remains in control — but still animates the other windows shifting to leave a gap at the preview index.

Returns
true when a preview started (all adoption modes included); false on an empty id, a non-autotile screen, a missing state, or the post-setup tiledWindowIndex < 0 rollback.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ cancelDragInsertPreview()

void PhosphorTileEngine::AutotileEngine::cancelDragInsertPreview ( bool dragStillActive = false)
overridevirtual

Cancel the active drag-insert preview, restoring the original order.

dragStillActive carries the base-interface contract (the previewed window is still under an interactive move, so the cancel's own retiles must keep skipping its geometry). Ignored when the daemon-set interactive-drag mark names a DIFFERENT window than the preview: the preview is then stale residue from an earlier drag, nobody is holding its window, and suppressing its snap-back would park it at the previewed rect until an unrelated retile.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ capturedWindowOrder()

QStringList PhosphorTileEngine::AutotileEngine::capturedWindowOrder ( const QString & screenId) const

◆ capturePlacement()

std::optional< PhosphorEngine::WindowPlacement > PhosphorTileEngine::AutotileEngine::capturePlacement ( const QString & windowId) const
overridevirtual

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 from PhosphorEngine::IPlacementEngine.

◆ capturePlacementForKey()

std::optional< PhosphorEngine::WindowPlacement > PhosphorTileEngine::AutotileEngine::capturePlacementForKey ( const QString & windowId,
const PhosphorEngine::TilingStateKey & key ) const

capturePlacement against ONE of the window's contexts rather than its primary.

The teardown paths capture the state they are tearing down, which for a window present on several desktops is not necessarily the primary — and the primary's state can already be gone earlier in the same sweep.

◆ claimCrossScreenReopen()

bool PhosphorTileEngine::AutotileEngine::claimCrossScreenReopen ( const QString & windowId,
const QString & openingScreenId,
int minWidth,
int minHeight )
overridevirtual

The reopen claim (see IPlacementEngine for the contract): only a FIFO record on another virtual screen of the opening output, in autotile mode, for a window opening on an autotile screen; never a record on another monitor and never the window's own.

This implementation: first-observation gate by TilingState MEMBERSHIP; a shouldTileWindow precondition (the open path REFUSES untileable windows after keying); the store's claim-honouring, live-excluding peekForReclaim; the home in the LIVE autotile set, a matching home context and a home open that would TILE the window; returns the REAL adoption outcome.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ clearAutotileFloated()

void PhosphorTileEngine::AutotileEngine::clearAutotileFloated ( const QString & rawWindowId)

◆ clearCurrentDesktopForScreen()

void PhosphorTileEngine::AutotileEngine::clearCurrentDesktopForScreen ( const QString & screenId)
overridevirtual

Drop a screen's per-output desktop, reverting it to m_context's global desktop.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ clearModeSpecificFloatMarker()

void PhosphorTileEngine::AutotileEngine::clearModeSpecificFloatMarker ( const QString & windowId)
inlineoverridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ clearPendingInitialOrder()

void PhosphorTileEngine::AutotileEngine::clearPendingInitialOrder ( const QString & screenId)

Drop a screen's initial-order seed: the order, its generation counter and its strict marker, which only ever live or die together.

The seed is keyed by bare screen id but probed and consumed against the screen's CONTEXT, so anything that moves the context invalidates it — otherwise one desktop's saved order is applied to another's layout.

◆ clearPerScreenConfig()

void PhosphorTileEngine::AutotileEngine::clearPerScreenConfig ( const QString & screenId)
overridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ clearScreenScheduling()

void PhosphorTileEngine::AutotileEngine::clearScreenScheduling ( const QString & screenId)

Drop every per-screen SCHEDULING entry for screenId: pending retiles, retile retry state, and the deferred post-retile focus.

Shared by the toggle-off removal loop and the orphaned-virtual-screen teardown — a stale entry keyed to a vs:N id would fire against the RECREATED id of a later re-subdivision.

◆ commitDragInsertPreview()

void PhosphorTileEngine::AutotileEngine::commitDragInsertPreview ( )
overridevirtual

Commit the active drag-insert preview.

Clears preview state and retiles normally so the dragged window's geometry is applied (KWin is finishing the interactive move and will accept the geometry set).

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ computeDragInsertIndexAtPoint()

int PhosphorTileEngine::AutotileEngine::computeDragInsertIndexAtPoint ( const QString & screenId,
const QPoint & cursorPos ) const

Compute the insert index for a cursor position on an autotile screen.

Walks the screen's current calculated zones and returns the index of the first zone that contains the cursor. When the cursor is beyond all zones: holds at the active preview's lastInsertIndex if a preview is live (the normal call context — keeps the slot stable while the cursor crosses gaps), otherwise falls back to the last tiled index. Returns 0 when the state exists but has no zones yet, and -1 if the screen has no tiling state. updateDragInsertPreview() clamps to [0, tiledWindowCount()-1], so returning the last slot is equivalent to "append".

The dragged window's zone is intentionally NOT excluded from the hit test: cursor-over-own-zone returns its current index (stable identity), preventing an oscillating shuffle where moving to a neighbour slot immediately re-matches under the cursor every dragMoved tick.

Engine-local int form (see updateDragInsertPreview); the struct override below wraps it for IPlacementEngine callers.

◆ computeDragInsertTargetAtPoint()

DragInsertTarget PhosphorTileEngine::AutotileEngine::computeDragInsertTargetAtPoint ( const QString & screenId,
const QPoint & cursorPos ) const
overridevirtual

IPlacementEngine drop-target form: wraps the flat index into DragInsertTarget::primary (invalid when the screen has no state).

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ config()

AutotileConfig * PhosphorTileEngine::AutotileEngine::config ( ) const
noexcept

Get the autotile configuration.

Returns
Pointer to configuration

◆ currentActivity()

const QString & PhosphorTileEngine::AutotileEngine::currentActivity ( ) const
inlinenoexcept

Get the current activity tracked by the engine.

◆ currentAlgorithm()

PhosphorTiles::TilingAlgorithm * PhosphorTileEngine::AutotileEngine::currentAlgorithm ( ) const

Get the current algorithm instance.

Returns
Pointer to algorithm, or nullptr if none set

◆ currentDesktop()

int PhosphorTileEngine::AutotileEngine::currentDesktop ( ) const
inlinenoexcept

Get the current virtual desktop tracked by the engine.

◆ cycleFocus()

void PhosphorTileEngine::AutotileEngine::cycleFocus ( bool forward,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Cycle keyboard focus through managed windows.

Implements PhosphorEngine::IPlacementEngine.

◆ decreaseMasterCount()

void PhosphorTileEngine::AutotileEngine::decreaseMasterCount ( )
overridevirtual

Decrease the number of master windows.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ decreaseMasterRatio()

void PhosphorTileEngine::AutotileEngine::decreaseMasterRatio ( qreal delta = kDefaultSplitRatioStep)
overridevirtual

Decrease the master area ratio.

Makes the master area smaller by the specified delta.

Parameters
deltaAmount to decrease (default 0.05 = 5%)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ demoteFromMaster()

void PhosphorTileEngine::AutotileEngine::demoteFromMaster ( const QString & windowId)

Demote a window from the master area.

Moves the window from master to the stack area.

Parameters
windowIdWindow to demote

◆ desktopsWithActiveState()

QSet< int > PhosphorTileEngine::AutotileEngine::desktopsWithActiveState ( ) const
overridevirtual

The virtual-desktop numbers any per-context entry names: a state, a parked context, a tuned flag, a stashed bag or a dirty memo.

Used by the daemon's desktop-count-changed handler to find stale desktops (entries on desktop > newCount) so they can be pruned via pruneStatesForDesktop(). The m_states map itself stays private; per-screen lookup is available through tilingStateForScreen(screenId). (Design notes on why the older screenStates() accessor was removed live above the definition in src/autotileengine/algorithm_state.cpp.)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ dragInsertPreviewPriorScreenId()

QString PhosphorTileEngine::AutotileEngine::dragInsertPreviewPriorScreenId ( ) const
inlineoverridevirtual

The screen the previewed window sat on before begin adopted it.

Empty without a preview, and empty when begin took the window from untracked (hadPriorState false), in which case there is nothing to restore it to and no prior screen to speak of.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ dragInsertPreviewScreenId()

QString PhosphorTileEngine::AutotileEngine::dragInsertPreviewScreenId ( ) const
inlineoverridevirtual

Get the target screen ID of the active drag-insert preview, or empty.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ dragInsertPreviewWindowId()

QString PhosphorTileEngine::AutotileEngine::dragInsertPreviewWindowId ( ) const
inline

Get the window ID of the active drag-insert preview, or empty.

Test seam — no production caller; the daemon compares against its own dragged-window id instead (ScrollEngine's twin carries the same note).

◆ dropParked()

void PhosphorTileEngine::AutotileEngine::dropParked ( const QString & windowId,
const QString & physicalScreenId,
int desktop,
const QString & activity )
overridevirtual

Forget windowId's parked contexts; an empty physicalScreenId, a desktop of 0 or an empty activity matches every one.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ effectiveAlgorithm()

PhosphorTiles::TilingAlgorithm * PhosphorTileEngine::AutotileEngine::effectiveAlgorithm ( const QString & screenId) const

◆ effectiveAlgorithmId()

QString PhosphorTileEngine::AutotileEngine::effectiveAlgorithmId ( const QString & screenId) const

◆ effectiveInnerGap()

int PhosphorTileEngine::AutotileEngine::effectiveInnerGap ( const QString & screenId) const

◆ effectiveInsertPosition()

PhosphorTiles::AutotileInsertPosition PhosphorTileEngine::AutotileEngine::effectiveInsertPosition ( const QString & screenId) const

◆ effectiveMaxWindows()

int PhosphorTileEngine::AutotileEngine::effectiveMaxWindows ( const QString & screenId) const

◆ effectiveOuterGaps()

::PhosphorLayout::EdgeGaps PhosphorTileEngine::AutotileEngine::effectiveOuterGaps ( const QString & screenId) const

◆ effectiveRespectMinimumSize()

bool PhosphorTileEngine::AutotileEngine::effectiveRespectMinimumSize ( const QString & screenId) const

◆ effectiveSmartGaps()

bool PhosphorTileEngine::AutotileEngine::effectiveSmartGaps ( const QString & screenId) const

◆ effectiveSplitRatioStep()

qreal PhosphorTileEngine::AutotileEngine::effectiveSplitRatioStep ( const QString & screenId) const
overridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ enabledChanged

void PhosphorTileEngine::AutotileEngine::enabledChanged ( bool enabled)
signal

Emitted when the enabled state changes.

Parameters
enabledNew enabled state

◆ engineId()

QString PhosphorTileEngine::AutotileEngine::engineId ( ) const
inlineoverridevirtual

Stable engine identity for HandoffContext.fromEngineId.

Conventional values: "snap" / "autotile" / "scrolling". Empty string means "unidentified" and disables receive-side reasoning that depends on the source mode.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ entryWindowForCrossing()

QString PhosphorTileEngine::AutotileEngine::entryWindowForCrossing ( const QString & screenId,
const QString & direction ) const

Cross-mode swap support (queried by the daemon when THIS engine is the target): the tiled window at screenId's entry edge facing the source for a crossing arriving in direction — the swap partner.

Empty when the screen has no tiled windows.

◆ floatWindow()

void PhosphorTileEngine::AutotileEngine::floatWindow ( const QString & windowId)

Float a specific window by its ID (convenience forwarder).

No production D-Bus adaptor routes here (the tiling adaptor's floatWindow/unfloatWindow verbs were removed); the forwarders serve the engine's test suite and scripted invocation. They pass no caller screen, so a refusal's windowFloatingStateSynced(false) names an empty screen — a production caller must use setWindowFloat with the caller's screen instead.

◆ focusInDirection() [1/2]

void PhosphorTileEngine::AutotileEngine::focusInDirection ( const QString & direction,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Move keyboard focus to the adjacent window.

Implements PhosphorEngine::IPlacementEngine.

◆ focusInDirection() [2/2]

void PhosphorTileEngine::AutotileEngine::focusInDirection ( const QString & direction,
const QString & action = QStringLiteral("focus") )

Focus the adjacent window in tiling order with OSD feedback.

Maps directional focus/cycle shortcuts to autotile's linear order.

Parameters
directionDirection string ("left", "right", "up", "down")
actionOSD action label — "focus" or "cycle" (defaults to "focus")

◆ focusMaster()

void PhosphorTileEngine::AutotileEngine::focusMaster ( )
overridevirtual

Focus the master window.

For algorithms with a master concept, focuses the master window.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ focusNext()

void PhosphorTileEngine::AutotileEngine::focusNext ( )

Focus the next tiled window.

Cycles forward through the tiled window list.

◆ focusPrevious()

void PhosphorTileEngine::AutotileEngine::focusPrevious ( )

Focus the previous tiled window.

Cycles backward through the tiled window list.

◆ handoffReceive()

void PhosphorTileEngine::AutotileEngine::handoffReceive ( const HandoffContext & ctx)
overridevirtual

Receive ownership of a window from another engine.

Implementations should:

  • Add the window to their own tracking (per-screen/per-state).
  • Decide placement (snap to zone / tile / float) using the context and engine-local policy. Drag drops typically place at dropPos; non-drag handoffs (cross-engine focus changes, programmatic moves) typically respect wasFloating (the window keeps its live frame, so no geometry is carried in the context).
  • Emit any 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 from PhosphorEngine::IPlacementEngine.

◆ handoffRelease()

void PhosphorTileEngine::AutotileEngine::handoffRelease ( const QString & windowId)
overridevirtual

Release ownership of a window WITHOUT modifying its geometry.

Implementations should:

  • Remove the window from per-screen/per-state tracking.
  • Clear zone assignments (if any) WITHOUT triggering a resnap of neighbours — that's the receiving engine's job once it places the window in its layout.
  • Preserve any pre-tile / pre-float captured geometry that should survive the cross-engine move (the receiving engine may consult it via the HandoffContext for size preservation).

Default is a no-op for the same reason as handoffReceive.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ hasDragInsertPreview()

bool PhosphorTileEngine::AutotileEngine::hasDragInsertPreview ( ) const
inlineoverridevirtual

Query whether a drag-insert preview is currently active.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ hasParked()

bool PhosphorTileEngine::AutotileEngine::hasParked ( const QString & windowId,
const QString & physicalScreenId ) const
overridevirtual

Whether windowId has a context parked under physicalScreenId (any output when it is empty).

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ hasPerScreenOverride()

bool PhosphorTileEngine::AutotileEngine::hasPerScreenOverride ( const QString & screenId,
const QString & key ) const

◆ heldKeyForWindow()

std::optional< PhosphorEngine::PlacementStateKey > PhosphorTileEngine::AutotileEngine::heldKeyForWindow ( const QString & windowId) const
overridevirtual

The (screen, desktop, activity) key of the state that genuinely holds windowId, tiled or floating, in ANY context, or nullopt when none does.

Membership-grade like heldScreenForWindow but NOT scoped to the screen's current context: for a lifecycle engine the desktop reconcile asks "which desktop's stack still lists this window" after the compositor reports a desktop-set change, when the holding state is usually a BACKGROUND one the current-context predicates answer empty for.

At most ONE key comes back: the PRIMARY membership (the one in the context its screen shows, else the first) when its state genuinely holds the window, otherwise the first membership whose state does. The membership pass answers for a window's other desktops. nullopt is not "no state mentions this window": a phantom membership left by a refused adoption answers nullopt too, the safe direction here. ScrollEngine answers nullopt during a drag-insert preview (the window is detached from the strip until the drop or cancel).

All three engines override it. The reconcile asks only a lifecycle engine; snapping, a membership engine, answers for its Meta+F test, the bus swap's held context and the window-state rows.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ heldScreenForWindow()

QString PhosphorTileEngine::AutotileEngine::heldScreenForWindow ( const QString & windowId) const
overridevirtual

OPTIONAL: the screen this engine genuinely HOLDS the window on IN THE SCREEN'S CURRENT CONTEXT — a MEMBERSHIP answer (tiled or engine-floating both count; a phantom reverse-map key does not), empty when the engine does not hold it or holds it only in a background context.

Read where the engine's own hold matters more than the window's position: the daemon's seed filter, engine routing and tiled-in-view predicate, the tracking adaptor's capture, focus, resize and screen-leave paths, and the tiling adaptor's arrival dispatch, where after a claim onto another virtual screen the effect's queued announce still carries the ARRIVAL screen. isWindowTracked cannot serve: its contract is PER-ENGINE (ScrollEngine answers from a raw reverse-map key a refused adoption can leave dangling; SnapEngine and AutotileEngine verify membership). isWindowManaged/isWindowTiled cannot either: both exclude engine-floating windows, which a claim can produce.

CURRENT-context only, so the check never suppresses repair: a claim's adoption keys by the home screen's current context, while a stale hold in a BACKGROUND context is healed by the very announce this check would otherwise refuse.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ increaseMasterCount()

void PhosphorTileEngine::AutotileEngine::increaseMasterCount ( )
overridevirtual

Increase the number of master windows.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ increaseMasterRatio()

void PhosphorTileEngine::AutotileEngine::increaseMasterRatio ( qreal delta = kDefaultSplitRatioStep)
overridevirtual

Increase the master area ratio.

Makes the master area larger by the specified delta.

Parameters
deltaAmount to increase (default 0.05 = 5%)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ isActiveOnScreen()

bool PhosphorTileEngine::AutotileEngine::isActiveOnScreen ( const QString & screenId) const
overridevirtual

Whether this engine is active on the given screen.

Implements PhosphorEngine::IPlacementEngine.

◆ isAutotileFloated()

bool PhosphorTileEngine::AutotileEngine::isAutotileFloated ( const QString & rawWindowId) const

◆ isAutotileScreen()

bool PhosphorTileEngine::AutotileEngine::isAutotileScreen ( const QString & screenId) const

Check if a specific screen uses autotile.

Parameters
screenIdScreen to check
Returns
true if the screen has an autotile assignment

◆ isEnabled()

bool PhosphorTileEngine::AutotileEngine::isEnabled ( ) const
overridevirtualnoexcept

Check if any screen has autotile enabled.

Returns
true if at least one screen uses autotile

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ isModeSpecificFloated()

bool PhosphorTileEngine::AutotileEngine::isModeSpecificFloated ( const QString & windowId) const
inlineoverridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ isWindowFloatingInAutotile()

bool PhosphorTileEngine::AutotileEngine::isWindowFloatingInAutotile ( const QString & windowId) const

Authoritative per-window autotile float state.

Returns true iff the window is tracked by autotile AND its owning TilingState marks it floating. This is the autotile engine's half of the per-engine float contract: the daemon's WTS float resolver consults this for windows whose current screen mode is Autotile (the snap half is SnapState::isFloating). Distinct from isModeSpecificFloated(), which reports the mode-transition MARKER (autotile-originated float), not the live TilingState float.

◆ isWindowManaged()

bool PhosphorTileEngine::AutotileEngine::isWindowManaged ( const QString & windowId) const
inlineoverridevirtual

Whether the engine considers the window "managed" (eligible for layout operations).

Semantics are engine-specific:

  • Autotile: equivalent to isWindowTiled (floating windows excluded).
  • Scrolling: the window occupies a strip column (floating windows excluded), same shape as autotile.
  • Snap: NOT implemented — SnapEngine keeps the inherited false. Callers that need a consistent cross-engine check for "engine owns this window at all" should use isWindowTracked instead; that is also the only correct check on a snap screen.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ isWindowTiled()

bool PhosphorTileEngine::AutotileEngine::isWindowTiled ( const QString & rawWindowId) const
overridevirtual

Check if a window is currently tiled (tracked AND not floating).

Used by the drag protocol's Reorder mode to decide whether a dragged window should enter the drag-insert preview (tiled windows reorder; floating / untracked windows drag free and float on drop as before).

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ isWindowTracked()

bool PhosphorTileEngine::AutotileEngine::isWindowTracked ( const QString & windowId) const
inlineoverridevirtual

Check if a window is currently tracked in any autotile state.

Used by the drag protocol (beginDrag) to decide whether to apply an immediate free-floating-size restore when a tiled window is picked up, and by the float/handoff routing in WindowTrackingAdaptor to choose between this engine and the adoption handoff.

MEMBERSHIP-VERIFIED, not a bare reverse-map lookup. The reverse window→key map is not authoritative on its own: a refused insert can leave a key pointing at a state that does not hold the window (Discussion #1028), and every consumer of this predicate then misroutes — beginDrag floats a window the engine does not hold, and the float adaptor dispatches setWindowFloat into the not-tracked refusal instead of the adoption handoff that would repair the state. The per-site phantom-key sweeps close known producers of that mismatch; verifying membership here closes the CLASS for this predicate's consumers, so a producer nobody has found yet degrades into a routing decision that self-corrects through adoption rather than a silent dead-end. The raw-lookup accessors (keyForWindow, screenForTrackedWindow) still answer from the bare reverse map and can name a phantom's screen until the next dispatch sweeps it — callers needing the membership answer must use this predicate or heldScreenForWindow.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ lastManagedRect()

QRect PhosphorTileEngine::AutotileEngine::lastManagedRect ( const QString & rawWindowId) const
overridevirtual

The tile rect this engine last emitted for rawWindowId via applyTiling, remembered PAST the window's transition out of the tiled state (see the base doc: on a float toggle the tiled bit clears before the compositor repositions the window, and the capture orchestrator needs this rect to recognise the still-tiled live frame).

Invalid when the window was never tiled here (or has closed).

Reimplemented from PhosphorEngine::PlacementEngineBase.

◆ layoutSupport()

LayoutSupport PhosphorTileEngine::AutotileEngine::layoutSupport ( ) const
inlineoverridevirtual

Autotile algorithms appear as cards in the layout picker / quick slots, so this engine is a placement-layout consumer too.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ loadState()

void PhosphorTileEngine::AutotileEngine::loadState ( )
overridevirtual

Load tiling state via persistence delegate (IPlacementEngine contract).

Delegates to the load function set by setPersistenceDelegate(). Wired by the daemon to WTA's loadState(). Autotiled windows reopen at their saved position from the unified WindowPlacementStore (insertWindow consumes the record), not from a separate window-order key.

Implements PhosphorEngine::IPlacementEngine.

◆ managedFocusedWindow()

QString PhosphorTileEngine::AutotileEngine::managedFocusedWindow ( const QString & screenId) const
overridevirtual

Capture half only.

This engine paints no view of its own, so it has nothing to restore on the way IN (setInitialFocusedWindow keeps the interface's no-op default) — but a screen flipping OUT of autotile still has to tell the incoming engine which window the user was on.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ managedWindowOrder()

QStringList PhosphorTileEngine::AutotileEngine::managedWindowOrder ( const QString & screenId) const
inlineoverridevirtual

Capture-on-leave order: the tiled order PLUS minimize-floated windows at their windowOrder positions.

A minimize-float is a suspension, not intent — dropping it here (as a bare tiledWindows() read would) makes the window's position vanish from the saved order, so a tiled→minimize→mode-round-trip loses its slot even though the seed filter deliberately keeps minimized windows as placeholders. Genuine (non-minimized) floats stay excluded.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ markAutotileFloated()

void PhosphorTileEngine::AutotileEngine::markAutotileFloated ( const QString & rawWindowId)

◆ markModeSpecificFloated()

void PhosphorTileEngine::AutotileEngine::markModeSpecificFloated ( const QString & windowId)
inlineoverridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ moveFocusedInDirection()

void PhosphorTileEngine::AutotileEngine::moveFocusedInDirection ( const QString & direction,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Move the focused window to the adjacent slot.

Implements PhosphorEngine::IPlacementEngine.

◆ moveFocusedToPosition() [1/2]

void PhosphorTileEngine::AutotileEngine::moveFocusedToPosition ( int position)

Move the focused window to a specific position in the tiling order.

Maps "snap to zone N" shortcuts to autotile positions.

Parameters
positionTarget position (1-based, clamped to valid range)

◆ moveFocusedToPosition() [2/2]

void PhosphorTileEngine::AutotileEngine::moveFocusedToPosition ( int position,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Move the focused window to the Nth position.

Implements PhosphorEngine::IPlacementEngine.

◆ noteCrossScreenClaimsExhausted()

void PhosphorTileEngine::AutotileEngine::noteCrossScreenClaimsExhausted ( const QString & windowId,
bool exhausted )
overridevirtual

INERT, kept for ABI: fed the removed cross-screen defer gates.

Nothing calls it and the in-tree overrides ignore it.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ noteMasterCountUserTuned()

void PhosphorTileEngine::AutotileEngine::noteMasterCountUserTuned ( const QString & screenId)

◆ noteSplitRatioUserTuned()

void PhosphorTileEngine::AutotileEngine::noteSplitRatioUserTuned ( const QString & screenId)

◆ notifyAlgorithmWindowAdded()

void PhosphorTileEngine::AutotileEngine::notifyAlgorithmWindowAdded ( PhosphorTiles::TilingState * state,
const QString & screenId,
const QString & windowId )

Run the algorithm's onWindowAdded lifecycle hook for a just-inserted window.

Shared by every insert site (onWindowAdded, handoffReceive, the strict-initial-order seed in setAutotileScreens) so a memory algorithm's bookkeeping (e.g. dwindle-memory's split tree) sees every arrival. Floating arrivals are not in tiledWindows(), so indexOf misses and the hook is correctly skipped.

◆ onWindowResized()

void PhosphorTileEngine::AutotileEngine::onWindowResized ( const QString & rawWindowId,
const QRect & oldFrame,
const QRect & newFrame,
const QString & screenId )
overridevirtual

Reflow neighbors after a window was interactively resized.

Entry point for the "drag an edge, neighbors fill the gap" behaviour (GitHub #652). Called by the daemon's WindowTracking adaptor when the compositor reports an interactive resize of a tiled window has finished.

For tree/memory algorithms the moved edge(s) are mapped to the owning PhosphorTiles::SplitTree split(s), whose ratio is adjusted so the neighbour subtree absorbs the change, then the screen is retiled gap-free. Floating windows, single-window screens, cross-output drags, and algorithms without a reflow model are no-ops.

Parameters
rawWindowIdThe interactively-resized window (raw instance id; canonicalized internally to match the state/tree keys)
oldFrameThe window's frame geometry before the resize (drag baseline)
newFrameThe window's frame geometry after the resize
screenIdScreen the daemon resolved the window to (authoritative)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ parkOutput()

QStringList PhosphorTileEngine::AutotileEngine::parkOutput ( const QString & physicalScreenId)
overridevirtual

Copy every context of physicalScreenId (each of its virtual screens) into the park, before the prune drops them.

Returns the parked windows.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ perScreenOverrides()

QVariantMap PhosphorTileEngine::AutotileEngine::perScreenOverrides ( const QString & screenId) const
overridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ promoteToMaster()

void PhosphorTileEngine::AutotileEngine::promoteToMaster ( const QString & windowId)

Promote a window to the master area.

For algorithms with a master concept, moves the window to the master position. For other algorithms, moves to the first position.

Parameters
windowIdWindow to promote

◆ pruneStaleWindows()

int PhosphorTileEngine::AutotileEngine::pruneStaleWindows ( const QSet< QString > & aliveWindowIds)
overridevirtual

Drop any per-engine bookkeeping for windows not in aliveWindowIds.

The base keeps no per-window state of its own now, so it returns 0; engines override and add their own pruning (then call the base).

Reimplemented from PhosphorEngine::PlacementEngineBase.

◆ pruneStatesForActivities()

void PhosphorTileEngine::AutotileEngine::pruneStatesForActivities ( const QStringList & validActivities)
overridevirtual

Prune PhosphorTiles::TilingState entries for activities not in the given set.

Removes states whose activity is non-empty and not in validActivities. Called when activities change so stale entries don't accumulate.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ pruneStatesForDesktop()

void PhosphorTileEngine::AutotileEngine::pruneStatesForDesktop ( int removedDesktop)
overridevirtual

Prune every TilingState of removedDesktop, releasing its windows.

remapDesktops moves the rest through a change of KWin's desktop list, the renumber's one removal included (src/autotileengine/desktopremap.cpp).

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ pruneStatesForRemovedScreen()

void PhosphorTileEngine::AutotileEngine::pruneStatesForRemovedScreen ( const QString & physicalScreenId)
overridevirtual

Prune PhosphorTiles::TilingState entries for a permanently removed monitor.

Prune every TilingState (all desktops/activities) whose screen is the removed physical output or one of its virtual sub-screens. updateEngineScreens only reaps CURRENT-context states, so without this the sibling-context states of an unplugged monitor would leak and resurface ghost tiles when the connector returns. Mirrors SnapEngine::pruneStatesForRemovedScreen.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ purgeFromPendingOrders()

void PhosphorTileEngine::AutotileEngine::purgeFromPendingOrders ( const QString & windowId)

Purge windowId from every pending initial order, with full bookkeeping: empty orders drop their generation/strict entries, and surviving orders are re-checked for resolution.

The single purge used by close, cap-rejection, and any other per-window drop — a bare removeAll leaves an empty order's timeout re-arm chain alive.

◆ pushToEmptyZone()

void PhosphorTileEngine::AutotileEngine::pushToEmptyZone ( const PhosphorEngine::NavigationContext & ctx)
overridevirtual

Move the focused window to the first empty slot.

Engines whose placement has no empty-slot concept answer with a "push"/"not_supported" feedback emit rather than silence — the shortcut must not read as broken (same policy the span default documents above).

Implements PhosphorEngine::IPlacementEngine.

◆ readoptParked()

bool PhosphorTileEngine::AutotileEngine::readoptParked ( const QString & windowId,
const QString & parkedPhysicalId,
const QString & returnedPhysicalId )
overridevirtual

Re-seat windowId's contexts parked under parkedPhysicalId on returnedPhysicalId as a re-statement (no focus, no last-used), each in its own (screen, desktop, activity): its virtual screen on the returned output (or the bare output), never the context in view.

One that no longer runs the engine's mode as the daemon resolves it gets nothing (snap also refuses one switched off, disabled or excluding the window); one out of view is seated at once, or granted to the arrival path on a screen not running the mode yet. True if any was.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ reapplyLayout()

void PhosphorTileEngine::AutotileEngine::reapplyLayout ( const PhosphorEngine::NavigationContext & ctx)
overridevirtual

Re-apply the current layout to all managed windows.

Implements PhosphorEngine::IPlacementEngine.

◆ reapplyManagedWindowAppearance()

void PhosphorTileEngine::AutotileEngine::reapplyManagedWindowAppearance ( )
overridevirtual

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 from PhosphorEngine::IPlacementEngine.

◆ reconcileDesktopMemberships()

PhosphorEngine::MembershipReconcileResult PhosphorTileEngine::AutotileEngine::reconcileDesktopMemberships ( const QString & screenId,
const PhosphorEngine::DesktopSpanQuery & spanOf )
overridevirtual

Give a window a tile on every desktop it occupies.

Driven off the desktop SPAN, so {1,2} is handled like sticky. The other sticky modes grant nothing: shouldTileWindow refuses them.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ reconcileWindowMemberships()

PhosphorEngine::MembershipReconcileResult PhosphorTileEngine::AutotileEngine::reconcileWindowMemberships ( const QString & windowId,
const PhosphorEngine::DesktopSpanQuery & spanOf )
overridevirtual

The same pass for ONE window, on the screen it is held on.

The daemon calls it when the compositor reports that window's desktop set or activity changed, so a span shrink releases only the contexts the window left and a sticky transition adopts the context in view without waiting for a desktop switch.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ refreshConfigFromSettings()

void PhosphorTileEngine::AutotileEngine::refreshConfigFromSettings ( )
overridevirtual

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 from PhosphorEngine::IPlacementEngine.

◆ remapDesktops()

void PhosphorTileEngine::AutotileEngine::remapDesktops ( const PhosphorEngine::DesktopRemap & remap)
overridevirtual

OPTIONAL: KWin's desktop list changed (a removal, an insert or a reorder).

Move every structure keyed by a desktop number through remap and prune the removed desktops' (F763, F787). The default runs a change that only removes desktops as pruneStatesForDesktop then renumberDesktopsAfterRemoval per removal, highest first, and only logs an insert or a reorder, which it cannot apply. Defined in PlacementEngineBase.cpp. Appended last for ABI.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ renumberDesktopsAfterRemoval()

void PhosphorTileEngine::AutotileEngine::renumberDesktopsAfterRemoval ( int removedDesktop)
overridevirtual

Shift every per-(screen, desktop, activity) state ABOVE removedDesktop down by one, because Plasma renumbers x11 desktop numbers when a desktop in the middle is deleted (removing 2 of 4 makes 3 become 2 and 4 become 3).

The companion to pruneStatesForDesktop, which only drops the removed desktop's own state: without the shift every surviving higher state keeps its old number, and a consumer comparing a stored key against the compositor's numbers (the daemon's desktop-membership reconcile above all) reads a window that never moved as having left its desktop. The caller drives prune first, then this, knowing which desktop was removed (desktopCountChanged alone cannot tell). An implementation must move EVERY structure keyed by a PlacementStateKey or by a bare desktop number, walking the affected desktops in ASCENDING order so each target key is vacant when written. The single-removal form of remapDesktops.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ requestPostRetileFocus()

void PhosphorTileEngine::AutotileEngine::requestPostRetileFocus ( const QString & screenId,
const QString & windowId )

Request that a window is activated after the given screen's next applyTiling.

Stored in m_pendingFocusByScreen and emitted as activateWindowRequested AFTER windowsTiled, so the KWin effect's post-tile raise loop runs first and the activation lands on top of it. Keyed by screen so a request that outlives a no-op retile (early return before applyTiling) can only fire on ITS screen's next retile, never on another screen's. Used by operations that change which window should be frontmost (e.g. rotating an overlap layout).

◆ restoreFocusedWindow()

void PhosphorTileEngine::AutotileEngine::restoreFocusedWindow ( const PhosphorEngine::NavigationContext & ctx)
overridevirtual

Restore the focused window out of its managed state.

Implements PhosphorEngine::IPlacementEngine.

◆ retile()

void PhosphorTileEngine::AutotileEngine::retile ( const QString & screenId = QString())
overridevirtual

Force retiling of windows.

Recalculates and applies tiling for the specified screen, or all screens if screenId is empty.

Parameters
screenIdScreen to retile, or empty for all screens

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ retileAfterOperation()

void PhosphorTileEngine::AutotileEngine::retileAfterOperation ( const QString & screenId,
bool operationSucceeded )

Helper to retile a screen after a window operation.

Recalculates layout and applies tiling if enabled, then emits placementChanged. Only emits signal if operationSucceeded is true.

Parameters
screenIdScreen to retile
operationSucceededWhether the triggering operation actually changed something

◆ rotateWindowOrder()

void PhosphorTileEngine::AutotileEngine::rotateWindowOrder ( bool clockwise = true)

Rotate all tiled windows by one position.

Shifts all windows in the tiling order. Clockwise moves each window to the next position (first becomes last), counterclockwise moves each to the previous position (last becomes first).

Parameters
clockwiseDirection of rotation

◆ rotateWindows() [1/2]

void PhosphorTileEngine::AutotileEngine::rotateWindows ( bool clockwise,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Rotate all managed windows on the screen.

Implements PhosphorEngine::IPlacementEngine.

◆ rotateWindows() [2/2]

void PhosphorTileEngine::AutotileEngine::rotateWindows ( bool clockwise,
const QString & screenId )

◆ runtimeMaxWindows()

int PhosphorTileEngine::AutotileEngine::runtimeMaxWindows ( ) const
overridevirtual

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 from PhosphorEngine::IPlacementEngine.

◆ savedMaxWindowsForAlgorithm()

std::optional< int > PhosphorTileEngine::AutotileEngine::savedMaxWindowsForAlgorithm ( const QString & algorithmId) const
overridevirtual

The user's saved per-algorithm max-windows tuning, if any.

Consulted by the mixed-algorithm cap paths (PerScreenConfigResolver step 3 and the daemon's per-screen MaxWindows injection): when a screen's assigned algorithm differs from the engine's global one, the saved slot is the user's explicit tuning for that algorithm and must win over the algorithm's built-in default. std::nullopt when the algorithm has no saved slot.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ saveState()

void PhosphorTileEngine::AutotileEngine::saveState ( )
overridevirtual

Save tiling state via persistence delegate (IPlacementEngine contract).

Delegates to the save function set by setPersistenceDelegate(). Wired by the daemon to WTA's saveState(). Per-window autotile restore state is persisted by the common WindowPlacementStore (each window's tiled position is captured into the store); the placementChanged → WTA::scheduleSaveState() connection is what triggers that save.

Implements PhosphorEngine::IPlacementEngine.

◆ scheduleRetileForScreen()

void PhosphorTileEngine::AutotileEngine::scheduleRetileForScreen ( const QString & screenId)
overridevirtual

Schedule a deferred retile for a screen.

Adds the screen to the pending set and posts a QueuedConnection call to processPendingRetiles(). Multiple calls in the same event loop pass are coalesced — only one retile fires per screen.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ screenForTrackedWindow()

QString PhosphorTileEngine::AutotileEngine::screenForTrackedWindow ( const QString & windowId) const
inlineoverridevirtual

Return the screen this engine considers the window to be on (any context), or empty if the window isn't tracked by this engine.

The daemon's shortcut router consults it across engines, so a cross-engine handoff that emptied the source's tracking still routes the next shortcut to the engine that now owns the window.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setActiveScreenHint()

void PhosphorTileEngine::AutotileEngine::setActiveScreenHint ( const QString & screenId)
overridevirtual

Set the active screen hint for keyboard shortcut handlers.

Called before parameterless engine methods (focusMaster, increaseMasterCount, etc.) to ensure the engine operates on the correct virtual screen when no focused window has been tracked yet on that screen.

Parameters
screenIdResolved screen ID (virtual or physical)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setActiveScreens()

void PhosphorTileEngine::AutotileEngine::setActiveScreens ( const QSet< QString > & screens)
inlineoverridevirtual

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setAlgorithm()

void PhosphorTileEngine::AutotileEngine::setAlgorithm ( const QString & algorithmId)
overridevirtual

Set the tiling algorithm.

If the algorithm ID is invalid, falls back to the default algorithm.

Parameters
algorithmIdAlgorithm identifier from PhosphorTiles::AlgorithmRegistry

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setAutotileScreens()

void PhosphorTileEngine::AutotileEngine::setAutotileScreens ( const QSet< QString > & screens)

Set which screens use autotile (derived from layout assignments).

Computes added/removed screens, retiles newly-added ones, and emits enabledChanged if the overall state flips. Only processes states for the current desktop/activity — states for other desktops are preserved.

Identical-set re-emit (discussion #219): when called for a desktop/activity switch whose autotile set matches the previous context's, the set comparison early-returns but the engine still RE-EMITS autotileScreensChanged with the unchanged set and isDesktopSwitch=true — the compositor effect's catch-scan depends on that wakeup to re-add windows moved to this desktop while the user was away. An empty identical set skips the re-emit (nothing to catch).

Parameters
screensSet of screen names that should use autotile

◆ setContextGapProvider()

void PhosphorTileEngine::AutotileEngine::setContextGapProvider ( std::function< QVariantMap(const QString &screenId)> provider)

◆ setContextModeResolver()

void PhosphorTileEngine::AutotileEngine::setContextModeResolver ( ContextTilesResolver resolver)
inline

◆ setCrossSurfaceResolver()

void PhosphorTileEngine::AutotileEngine::setCrossSurfaceResolver ( PhosphorEngine::ICrossSurfaceResolver * resolver)
inlineoverridevirtual

Inject the cross-surface resolver (neighbouring output / desktop lookup) used by directional navigation when it reaches a layout boundary.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setCurrentActivity()

void PhosphorTileEngine::AutotileEngine::setCurrentActivity ( const QString & activity)
overridevirtual

Set the current activity for per-activity tiling state.

Swaps the active PhosphorTiles::TilingState set without releasing windows. Must be called BEFORE updateEngineScreens() on activity switch so the engine resolves states for the correct activity.

Parameters
activityActivity ID (empty string for no activity)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setCurrentDesktop()

void PhosphorTileEngine::AutotileEngine::setCurrentDesktop ( int desktop)
overridevirtual

Set the current virtual desktop for per-desktop tiling state.

Swaps the active PhosphorTiles::TilingState set without releasing windows. Must be called BEFORE updateEngineScreens() on desktop switch so the engine resolves states for the correct desktop.

Parameters
desktopVirtual desktop number (1-based from KWin)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setCurrentDesktopForScreen()

void PhosphorTileEngine::AutotileEngine::setCurrentDesktopForScreen ( const QString & screenId,
int desktop )
overridevirtual

Set a single screen's current virtual desktop (Plasma 6.7 per-output virtual desktops, #648).

Pure context swap: records the screen's desktop in m_context's per-output map so currentKeyForScreen() resolves that screen's per-(screen, desktop) state. Does NOT migrate windows between states — the other desktop's state stays put so it reappears when the screen returns. Like setCurrentDesktop(), call BEFORE updateEngineScreens() so the new key resolves.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setFloatPredicate()

void PhosphorTileEngine::AutotileEngine::setFloatPredicate ( FloatPredicate predicate)
inline

◆ setFocusedWindow()

void PhosphorTileEngine::AutotileEngine::setFocusedWindow ( const QString & windowId)

Notify the engine that a window has been focused.

Called by D-Bus adaptor when KWin reports a window focus change. Updates the focused window in the appropriate PhosphorTiles::TilingState.

Parameters
windowIdWindow ID that gained focus

◆ setFocusNewWindows()

void PhosphorTileEngine::AutotileEngine::setFocusNewWindows ( bool enabled)

◆ setGlobalMasterCount()

void PhosphorTileEngine::AutotileEngine::setGlobalMasterCount ( int count)

Set master count globally (config + every state, every desktop).

The master-count twin of setGlobalSplitRatio, with the same scope: global config plus every state on every desktop and activity, every per-desktop tuning dropped, and screens with an explicit per-screen MasterCount override left alone.

Parameters
countNew master count (clamped to valid range)

◆ setGlobalSplitRatio()

void PhosphorTileEngine::AutotileEngine::setGlobalSplitRatio ( qreal ratio)

Set master ratio globally (config + every state, every desktop).

Used by the D-Bus adaptor to set the ratio as an absolute value. This is the ABSOLUTE setter, so it means what it says: it writes the global config and every existing state on every desktop and activity, and it discards every per-desktop tuning recorded by increaseMasterRatio. A screen carrying an explicit per-screen SplitRatio override is the one exception and keeps it, mirroring propagateGlobalSplitRatio.

Contrast increaseMasterRatio, which is the RELATIVE nudge and stays local to one screen+desktop+activity.

Parameters
ratioNew split ratio (clamped to valid range)

◆ setInitialWindowOrder()

void PhosphorTileEngine::AutotileEngine::setInitialWindowOrder ( const QString & screenId,
const QStringList & windowIds )
overridevirtual

Pre-seed initial window order for deterministic snapping → autotile transitions.

When toggling from manual snapping to autotile, windows arrive in KWin stacking order (focus-based). This method stores a zone-ordered list so that insertWindow() can place windows in the correct autotile positions (zone 1 → master, etc.).

Only takes effect when the screen's PhosphorTiles::TilingState is empty (no prior windows from session restore). The pending order is consumed as windows are inserted.

Parameters
screenIdScreen to set initial order for
windowIdsWindow IDs in desired order (zone-number ascending)

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setInnerGap()

void PhosphorTileEngine::AutotileEngine::setInnerGap ( int gap)

◆ setInteractiveDragWindow()

void PhosphorTileEngine::AutotileEngine::setInteractiveDragWindow ( const QString & windowId)
overridevirtual

Mark windowId as under a compositor interactive move (IPlacementEngine contract).

Empty clears.

While set, applyTiling never emits this window's geometry: autotile keeps a dragged window modeled as a tile, so any retile that runs during the drag — a deferred geometry-retry, a window opening or closing on the screen, a settings retile, an engine-internal preview self-cancel — would otherwise apply the tile rect to the window in the user's hand (discussion #1028). The preview filter and the cancel filter cover only the preview's own lifecycle; this covers the whole drag. Clearing does NOT retile — every drop path finalizes on its own (commit re-applies, ApplyFloat floats the window out, a cancelled move has KWin restore the frame).

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ setOuterGap()

void PhosphorTileEngine::AutotileEngine::setOuterGap ( int gap)

◆ setPersistenceDelegate()

void PhosphorTileEngine::AutotileEngine::setPersistenceDelegate ( std::function< void()> saveFn,
std::function< void()> loadFn )
inline

Set persistence callbacks for save/load.

Persistence is owned by WindowTrackingAdaptor's session store (the engine has none). These callbacks allow AutotileEngine to fulfill the IPlacementEngine persistence contract with no storage dependency.

Parameters
saveFnCalled by saveState() to persist tiling state
loadFnCalled by loadState() to restore tiling state

◆ setRestorePositionPredicate()

void PhosphorTileEngine::AutotileEngine::setRestorePositionPredicate ( RestorePositionPredicate predicate)
inline

Inject the floated-position-restore gate.

Clear with {} before destroying any state captured by the closure (the daemon honours this on re-wire).

◆ setScrollingModeResolver()

void PhosphorTileEngine::AutotileEngine::setScrollingModeResolver ( std::function< bool(const QString &screenId, int desktop, const QString &activity)> resolver)
inline

INERT, kept for ABI: a scrolling-mode resolver that fed windowOpened's cross-screen tile-restore defer, which the reopen contract removed (a window opening on an autotile screen is autotile's).

Nothing reads the stored resolver and the daemon no longer wires it; a setter call is harmless.

◆ setSmartGaps()

void PhosphorTileEngine::AutotileEngine::setSmartGaps ( bool enabled)

◆ setWindowFloat()

void PhosphorTileEngine::AutotileEngine::setWindowFloat ( const QString & windowId,
bool shouldFloat,
const QString & screenId = QString() )
overridevirtual

Set the floating state of a specific window.

When shouldFloat is true, marks the window as floating (excluded from automatic tiling) and retiles the remaining windows. When false, removes the floating flag and re-inserts the window into the tiling layout.

Parameters
windowIdWindow identifier from KWin
shouldFloatTrue to float, false to unfloat
screenIdThe caller's live screen. An ordinary float/unfloat resolves the screen from the window's own tracking, which the focus-driven migration keeps current (see float_handoff.cpp's setWindowFloat). An unfloat for a window that holds no place in the desktop this screen shows adopts it into that context; a refused dispatch for a window with no tracked screen names this screen in its windowFloatingStateSynced(false) announcement.

Implements PhosphorEngine::IPlacementEngine.

◆ setWindowRegistry()

void PhosphorTileEngine::AutotileEngine::setWindowRegistry ( QObject * registry)
overridevirtual

Wire up the shared WindowRegistry.

Optional — tests construct the engine without a registry and fall back to string parsing (PhosphorIdentity::WindowId::extractAppId). Production daemons set this to the daemon-root registry so class lookups return the latest value after an Electron/CEF app renames itself mid-session.

Side effect: installs a live-class resolver on every PhosphorTiles::TilingAlgorithm in the PhosphorTiles::AlgorithmRegistry so PhosphorTiles::LuauTileAlgorithm's lifecycle hooks see the current appId on each tiled window. Future algorithm registrations (hot-reloaded Luau algorithms) pick up the resolver from the algorithmRegistered signal bound inside this method.

Must be set before start. Not owned.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ snapAllWindows()

void PhosphorTileEngine::AutotileEngine::snapAllWindows ( const PhosphorEngine::NavigationContext & ctx)
overridevirtual

Bring every unmanaged window on the screen back under this engine's placement (zones for snap, the strip for scrolling).

Stated layout-neutrally on purpose: an engine without a layout concept (layoutSupport() == LayoutSupport::None) still implements this intent.

Implements PhosphorEngine::IPlacementEngine.

◆ spanFocusedInDirection()

void PhosphorTileEngine::AutotileEngine::spanFocusedInDirection ( const QString & direction,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Grow or shrink the focused window's zone span toward the direction: extend into the adjacent zone(s) when some exist beyond that edge, otherwise retract the opposite edge.

Zone spanning is a snap-mode concept, so unlike the required intents above this has a default no-op, keeping the daemon free of engine-type branching. Engines that want the shortcut to give feedback instead of silence override it — AutotileEngine reports a "not_supported" failure OSD.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ stateForScreen() [1/2]

const PhosphorEngine::IPlacementState * PhosphorTileEngine::AutotileEngine::stateForScreen ( const QString & screenId) const
overridevirtual

◆ stateForScreen() [2/2]

PhosphorEngine::IPlacementState * PhosphorTileEngine::AutotileEngine::stateForScreen ( const QString & screenId)
overridevirtual

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.

Implements PhosphorEngine::IPlacementEngine.

◆ stickyPinnedDesktopForScreen()

int PhosphorTileEngine::AutotileEngine::stickyPinnedDesktopForScreen ( const QString & screenId) const
inlineoverridevirtual

The desktop this engine has pinned this screen to, or 0.

See the interface doc for why the gate compares the PIN and not the resolved key.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ swapFocusedInDirection() [1/2]

void PhosphorTileEngine::AutotileEngine::swapFocusedInDirection ( const QString & direction,
const PhosphorEngine::NavigationContext & ctx )
overridevirtual

Swap the focused window with the adjacent window.

Implements PhosphorEngine::IPlacementEngine.

◆ swapFocusedInDirection() [2/2]

void PhosphorTileEngine::AutotileEngine::swapFocusedInDirection ( const QString & direction,
const QString & action = QStringLiteral("move") )

Swap the focused window with the adjacent window in tiling order.

Maps directional keyboard shortcuts (move/swap window left/right/up/down) to autotile's linear tiling order. Forward swaps with the next window, backward swaps with the previous.

Parameters
directionDirection string ("left", "right", "up", "down")
actionOSD action label — "move" or "swap" (defaults to "move")

◆ swapFocusedWithMaster()

void PhosphorTileEngine::AutotileEngine::swapFocusedWithMaster ( )
overridevirtual

Swap the currently focused window with the master window.

Convenience method that promotes the focused window to master position. If the focused window is already master, this is a no-op.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ swapWindows()

void PhosphorTileEngine::AutotileEngine::swapWindows ( const QString & windowId1,
const QString & windowId2 )

Swap positions of two tiled windows.

Parameters
windowId1First window ID
windowId2Second window ID

◆ switchFocusBetweenFloatingAndTiling()

void PhosphorTileEngine::AutotileEngine::switchFocusBetweenFloatingAndTiling ( const QString & screenId)
overridevirtual

Jump focus between the float layer and the tiled layout.

niri's switch-focus-between-floating-and-tiling: activates the last focused window on the OTHER layer, falling back to a scan when the memory is stale. Windows the compositor has reported minimized are skipped (an unreported state is treated as visible — a focus verb must not refuse a window merely because its state is unknown). Built on the shared resolver (PhosphorEngine::resolveLayerFocusSwitch) so all engines answer identically; refusals report action "float", reason "no_target" when a layer has no eligible window and "no_windows" when no state resolves.

Parameters
screenIdTarget screen; empty resolves the focused screen

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ tiledWindowOrder()

QStringList PhosphorTileEngine::AutotileEngine::tiledWindowOrder ( const QString & screenId) const

Get the current tiled window order for a screen.

Returns the autotile engine's tiled window list for deterministic autotile → snapping transitions. Call BEFORE switching layouts so the PhosphorTiles::TilingState still exists.

Parameters
screenIdScreen to query
Returns
Ordered list of tiled window IDs (master first), or empty if no state

◆ tilingStateForScreen()

PhosphorTiles::TilingState * PhosphorTileEngine::AutotileEngine::tilingStateForScreen ( const QString & screenId)

Get the tiling state for a specific screen.

Creates the state if it doesn't exist.

Parameters
screenIdScreen identifier
Returns
Pointer to PhosphorTiles::TilingState (owned by engine)

◆ toggleFocusedFloat()

void PhosphorTileEngine::AutotileEngine::toggleFocusedFloat ( const PhosphorEngine::NavigationContext & ctx)
overridevirtual

Toggle the focused window between managed and floating.

Implements PhosphorEngine::IPlacementEngine.

◆ toggleFocusedWindowFloat()

void PhosphorTileEngine::AutotileEngine::toggleFocusedWindowFloat ( )

Toggle the focused window between tiled and floating states.

When the window is tiled, it becomes floating and is excluded from automatic tiling. When floating, it re-enters the tiling layout.

Note
Prefer toggleWindowFloat() which takes explicit IDs and avoids focus-tracking desync issues.

◆ toggleWindowFloat()

void PhosphorTileEngine::AutotileEngine::toggleWindowFloat ( const QString & windowId,
const QString & screenId )
overridevirtual

Toggle a specific window between tiled and floating states.

Bypasses internal focus tracking by using the caller-supplied windowId and screenId directly. This avoids silent no-ops caused by m_activeScreen or focusedWindow() desyncing from KWin's actual state after rapid repeated toggles.

Parameters
windowIdWindow identifier from KWin
screenIdScreen where the window is located

Implements PhosphorEngine::IPlacementEngine.

◆ unfloatWindow()

void PhosphorTileEngine::AutotileEngine::unfloatWindow ( const QString & windowId)

Unfloat a specific window by its ID (convenience forwarder).

Same audience and empty-screen caveat as floatWindow above.

◆ updateDragInsertPreview() [1/2]

void PhosphorTileEngine::AutotileEngine::updateDragInsertPreview ( const DragInsertTarget & target)
overridevirtual

IPlacementEngine drop-target form: primary is the tiled-only insert index; secondary/newSlot are meaningless for a flat stack and ignored.

An INVALID target is ignored outright — NOT clamped the way the int form clamps a negative index; a caller crossing the polymorphic seam must not rely on the int form's clamping contract.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ updateDragInsertPreview() [2/2]

void PhosphorTileEngine::AutotileEngine::updateDragInsertPreview ( int insertIndex)

Update the target insert index for the active drag preview.

Moves the dragged window within PhosphorTiles::TilingState to the new index (clamped to [0, tiledWindowCount()-1]) and retiles. No-op if the index hasn't changed from the last update.

Engine-local int form — autotile's native slot vocabulary IS a flat tiled-only index, so internal callers and tests keep the honest unit. The IPlacementEngine struct override below delegates here.

◆ updatePerScreenOverride()

void PhosphorTileEngine::AutotileEngine::updatePerScreenOverride ( const QString & screenId,
const QString & key,
const QVariant & value )

◆ updateStickyScreenPins()

void PhosphorTileEngine::AutotileEngine::updateStickyScreenPins ( const PhosphorEngine::StickyPredicate & ,
PhosphorEngine::StickyPinPhase  )
overridevirtual

Pin screens where all autotiled windows are sticky (on all desktops).

For screens where every tiled/floating window is sticky, pins the TilingStateKey desktop to the current effective desktop so that currentKeyForScreen() keeps resolving the existing state after a desktop switch. Screens where not all windows are sticky are unpinned, with state migrated to the screen's current desktop (its per-output desktop, else the global current one) if necessary. Acquire must run BEFORE setCurrentDesktop()/setCurrentActivity() and Release AFTER, so the migration targets the desktop being entered rather than the one being left. See PhosphorEngine::StickyPinPhase. The predicate answers true when a window is on all desktops.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ windowClosed()

void PhosphorTileEngine::AutotileEngine::windowClosed ( const QString & windowId)
overridevirtual

Notify the engine that a window was closed.

Called by Daemon when KWin reports a window closed. Triggers retiling to fill the gap left by the closed window.

Parameters
windowIdWindow identifier from KWin

Implements PhosphorEngine::IPlacementEngine.

◆ windowFocused()

void PhosphorTileEngine::AutotileEngine::windowFocused ( const QString & windowId,
const QString & screenId )
overridevirtual

Notify the engine that a window was focused.

Called by Daemon when KWin reports window activation. Updates focus tracking for tiling operations.

Parameters
windowIdWindow identifier from KWin
screenIdScreen where the window is located

Implements PhosphorEngine::IPlacementEngine.

◆ windowMinimumSize()

QSize PhosphorTileEngine::AutotileEngine::windowMinimumSize ( const QString & windowId) const
overridevirtual

The window's client-reported minimum size as last known by this engine, or an UNKNOWN answer when it has none.

Read by the cross-engine handoff dispatcher to seed HandoffContext::minSize; must be queried before handoffRelease. Default suits engines without a min-size model.

"Unknown" is spelled two ways in the tree and a caller must accept both: a default-constructed 0x0, and an INVALID QSize (-1x-1), which the scroll engine returns deliberately to distinguish "no entry" from "a real zero". Every in-tree consumer clamps with qMax against 0, which treats the two identically; a new consumer must do the same rather than assuming either.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ windowMinSizeUpdated()

void PhosphorTileEngine::AutotileEngine::windowMinSizeUpdated ( const QString & windowId,
int minWidth,
int minHeight )
overridevirtual

A window's minimum size changed after windowOpened (0 when unconstrained): retiles when it differs from the stored value.

Reimplemented from PhosphorEngine::IPlacementEngine.

◆ windowOpened()

void PhosphorTileEngine::AutotileEngine::windowOpened ( const QString & windowId,
const QString & screenId,
int minWidth,
int minHeight )
overridevirtual

A new window appeared on this engine's screen.

Implements PhosphorEngine::IPlacementEngine.

◆ windowOrderIndexForWindow()

int PhosphorTileEngine::AutotileEngine::windowOrderIndexForWindow ( const QString & screenId,
const QString & windowId ) const

The RAW window-order index of windowId on screenId (current desktop; counts floats, matching TilingState::addWindow), or -1 when not present — lets the daemon land a swap counterpart in the same slot the departing window held when re-inserted via HandoffContext.insertIndex.

◆ windowsTiled

void PhosphorTileEngine::AutotileEngine::windowsTiled ( const QString & tileRequestsJson)
signal

Emitted when windows are tiled to new geometries (batch).

JSON array of objects with windowId, x, y, width, height. The adaptor forwards to KWin effect.

Parameters
tileRequestsJsonJSON array of {windowId,x,y,width,height}

◆ writeBackTuning()

void PhosphorTileEngine::AutotileEngine::writeBackTuning ( )

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