13#include <phosphorengine_export.h>
34class ICrossSurfaceResolver;
95 virtual void windowOpened(
const QString& windowId,
const QString& screenId,
int minWidth = 0,
96 int minHeight = 0) = 0;
110 windowOpened(windowId, screenId, 0, 0);
141 Q_UNUSED(openingScreenId)
207 virtual void windowFocused(
const QString& windowId,
const QString& screenId) = 0;
234 virtual void setWindowFloat(
const QString& windowId,
bool shouldFloat,
const QString& screenId = QString()) = 0;
546 bool newSlot =
false;
547 bool leadingEdge =
false;
832 virtual void onWindowResized(
const QString& windowId,
const QRect& oldFrame,
const QRect& newFrame,
833 const QString& screenId)
893 bool wasFloating =
false;
894 bool heldFocus =
false;
901 int insertIndex = -1;
987 return LayoutSupport::None;
1015 Q_UNUSED(algorithmId)
1069 Q_UNUSED(isWindowSticky)
1077 Q_UNUSED(removedDesktop)
1081 Q_UNUSED(validActivities)
1096 Q_UNUSED(physicalScreenId)
1113 static constexpr qreal kDefaultSplitRatioStep = 0.05;
1117 return kDefaultSplitRatioStep;
1135 Q_UNUSED(algorithmId)
1136 return std::nullopt;
1143 virtual void retile(
const QString& screenId = QString())
Resolves the neighbouring surface — output or virtual desktop — in a direction, for cross-surface win...
Definition ICrossSurfaceResolver.h:21
Unified placement engine interface.
Definition IPlacementEngine.h:72
virtual QString activeScreen() const
Definition IPlacementEngine.h:1021
virtual QString dragInsertPreviewScreenId() const
Definition IPlacementEngine.h:585
virtual void applyPerScreenConfig(const QString &screenId, const QVariantMap &overrides)
Definition IPlacementEngine.h:478
virtual LayoutSupport layoutSupport() const
Default None: an engine must opt in to being a layout consumer.
Definition IPlacementEngine.h:985
virtual void increaseMasterCount()
Definition IPlacementEngine.h:1180
virtual QString engineId() const
Stable engine identity for HandoffContext.fromEngineId.
Definition IPlacementEngine.h:950
virtual void setAlgorithm(const QString &algorithmId)
Definition IPlacementEngine.h:1013
virtual void setWindowFloat(const QString &windowId, bool shouldFloat, const QString &screenId=QString())=0
Set floating state explicitly (directional, not toggle).
void windowOpened(const QString &windowId, const QString &screenId)
Convenience overload — equivalent to windowOpened(id, screen, 0, 0).
Definition IPlacementEngine.h:108
virtual void setCurrentActivity(const QString &activity)
Definition IPlacementEngine.h:1054
virtual QString heldScreenForWindow(const QString &windowId) const
OPTIONAL: the screen this engine genuinely HOLDS the window on IN THE SCREEN'S CURRENT CONTEXT — a ME...
Definition IPlacementEngine.h:172
virtual int runtimeMaxWindows() const
Runtime max-windows limit.
Definition IPlacementEngine.h:1122
virtual void setActiveScreenHint(const QString &screenId)
Definition IPlacementEngine.h:1025
virtual std::optional< int > savedMaxWindowsForAlgorithm(const QString &algorithmId) const
The user's saved per-algorithm max-windows tuning for algorithmId, or std::nullopt when the engine ke...
Definition IPlacementEngine.h:1133
virtual void windowMinSizeUpdated(const QString &windowId, int minWidth, int minHeight)
Update a window's minimum size after the initial windowOpened.
Definition IPlacementEngine.h:816
virtual void setWindowRegistry(QObject *registry)
Attach a window-class registry (QObject carrying WindowRegistry).
Definition IPlacementEngine.h:1164
virtual void onWindowResized(const QString &windowId, const QRect &oldFrame, const QRect &newFrame, const QString &screenId)
Notify the engine that a tracked window finished an interactive resize.
Definition IPlacementEngine.h:832
virtual void setCurrentDesktopForScreen(const QString &screenId, int desktop)
Set a single screen's current virtual desktop (Plasma 6.7 "switch desktops independently for each scr...
Definition IPlacementEngine.h:1044
virtual void setActiveScreens(const QSet< QString > &screens)
Definition IPlacementEngine.h:318
virtual void windowFocused(const QString &windowId, const QString &screenId)=0
A window gained focus (called when the compositor reports activation).
virtual QString screenForTrackedWindow(const QString &windowId) const
Return the screen this engine considers the window to be on, or empty if the window isn't tracked by ...
Definition IPlacementEngine.h:789
virtual bool isWindowTracked(const QString &windowId) const
Definition IPlacementEngine.h:751
virtual void commitDragInsertPreview()
Definition IPlacementEngine.h:579
virtual void spanFocusedInDirection(const QString &direction, const NavigationContext &ctx)
Grow or shrink the focused window's zone span toward the direction: extend into the adjacent zone(s) ...
Definition IPlacementEngine.h:253
virtual bool dragAutoScrollActive() const
Whether edge auto-scroll currently owns the drop target.
Definition IPlacementEngine.h:669
virtual void moveFocusedInDirection(const QString &direction, const NavigationContext &ctx)=0
Move the focused window to the adjacent slot.
virtual void scheduleRetileForScreen(const QString &screenId)
Definition IPlacementEngine.h:1147
virtual void swapFocusedWithMaster()
Definition IPlacementEngine.h:1189
virtual void cancelDragAutoScroll()
Give the drop target back and forget any armed band, WITHOUT moving the view or re-aiming.
Definition IPlacementEngine.h:683
virtual void handoffRelease(const QString &windowId)
Release ownership of a window WITHOUT modifying its geometry.
Definition IPlacementEngine.h:942
virtual bool isWindowTiled(const QString &windowId) const
Whether the window is actively tiled (engine-owned, non-floating).
Definition IPlacementEngine.h:773
virtual ~IPlacementEngine()=default
virtual void setCrossSurfaceResolver(ICrossSurfaceResolver *resolver)
Inject the cross-surface resolver used to find a neighbouring output / desktop when directional navig...
Definition IPlacementEngine.h:1063
virtual void setInitialWindowOrder(const QString &screenId, const QStringList &windowIds)
Definition IPlacementEngine.h:399
virtual void restoreFocusedWindow(const NavigationContext &ctx)=0
Restore the focused window out of its managed state.
virtual void clearCurrentDesktopForScreen(const QString &screenId)
Drop a screen's per-output desktop, reverting it to the global current.
Definition IPlacementEngine.h:1050
virtual IPlacementState * stateForScreen(const QString &screenId)=0
Per-screen state object for the given screen.
virtual void handoffReceive(const HandoffContext &ctx)
Receive ownership of a window from another engine.
Definition IPlacementEngine.h:925
virtual QSize windowMinimumSize(const QString &windowId) const
The window's client-reported minimum size as last known by this engine, or an UNKNOWN answer when it ...
Definition IPlacementEngine.h:805
virtual void focusMaster()
Definition IPlacementEngine.h:1186
virtual QString algorithmId() const
Definition IPlacementEngine.h:1009
virtual void saveState()=0
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 whos...
Definition IPlacementEngine.h:646
virtual bool hasDragInsertPreview() const
Definition IPlacementEngine.h:569
virtual void decreaseMasterRatio(qreal delta=kDefaultSplitRatioStep)
Definition IPlacementEngine.h:1176
virtual void focusInDirection(const QString &direction, const NavigationContext &ctx)=0
Move keyboard focus to the adjacent window.
virtual void windowOpened(const QString &windowId, const QString &screenId, int minWidth=0, int minHeight=0)=0
A new window appeared on this engine's screen.
virtual void beginArrivalBurst()
Bracket a BURST of windowOpened calls delivered together (the adaptor's three dispatch loops: windows...
Definition IPlacementEngine.h:194
virtual void clearModeSpecificFloatMarker(const QString &windowId)
Definition IPlacementEngine.h:513
virtual void moveFocusedToPosition(int position, const NavigationContext &ctx)=0
Move the focused window to the Nth position.
virtual bool providesDragInsertSelector() const
Whether the daemon's edge-triggered drag popup (the zone selector surface) should render this engine'...
Definition IPlacementEngine.h:1000
virtual void refreshConfigFromSettings()
Re-read all tuning values from the engine's settings interface.
Definition IPlacementEngine.h:1108
virtual void pruneStatesForRemovedScreen(const QString &physicalScreenId)
Prune per-(screen, desktop, activity) state for a PHYSICALLY REMOVED output (monitor hot-unplug),...
Definition IPlacementEngine.h:1094
virtual QSet< QString > activeScreens() const
Definition IPlacementEngine.h:314
virtual bool isWindowManaged(const QString &windowId) const
Whether the engine considers the window "managed" (eligible for layout operations).
Definition IPlacementEngine.h:765
virtual void retile(const QString &screenId=QString())
Definition IPlacementEngine.h:1143
virtual const IPlacementState * stateForScreen(const QString &screenId) const =0
virtual QString dragInsertPreviewPriorScreenId() const
The screen the previewed window was on BEFORE begin adopted it, or empty when it had no prior state (...
Definition IPlacementEngine.h:598
LayoutSupport
How this engine relates to user-selectable layouts — the entries the layout picker,...
Definition IPlacementEngine.h:964
virtual bool restorePlacement(const WindowPlacement &placement, const QString &screenId)
Apply placement to a (re)opening window on screenId.
Definition IPlacementEngine.h:383
virtual bool isEnabled() const noexcept
Definition IPlacementEngine.h:1017
virtual qreal effectiveSplitRatioStep(const QString &screenId) const
Definition IPlacementEngine.h:1114
virtual bool isActiveOnScreen(const QString &screenId) const =0
Whether this engine is active on the given screen.
virtual void toggleWindowFloat(const QString &windowId, const QString &screenId)=0
Toggle between managed and floating.
virtual void swapFocusedInDirection(const QString &direction, const NavigationContext &ctx)=0
Swap the focused window with the adjacent window.
virtual void increaseMasterRatio(qreal delta=kDefaultSplitRatioStep)
Definition IPlacementEngine.h:1172
virtual bool isModeSpecificFloated(const QString &windowId) const
Definition IPlacementEngine.h:508
virtual void rotateWindows(bool clockwise, const NavigationContext &ctx)=0
Rotate all managed windows on the screen.
virtual bool beginDragInsertPreview(const QString &windowId, const QString &screenId)
Definition IPlacementEngine.h:573
virtual void snapAllWindows(const NavigationContext &ctx)=0
Bring every unmanaged window on the screen back under this engine's placement (zones for snap,...
virtual void cycleFocus(bool forward, const NavigationContext &ctx)=0
Cycle keyboard focus through managed windows.
virtual void toggleFocusedFloat(const NavigationContext &ctx)=0
Toggle the focused window between managed and floating.
virtual void windowClosed(const QString &windowId)=0
A window was closed.
IPlacementEngine()=default
virtual void clearPerScreenConfig(const QString &screenId)
Definition IPlacementEngine.h:483
IPlacementEngine(const IPlacementEngine &)=delete
virtual void reapplyLayout(const NavigationContext &ctx)=0
Re-apply the current layout to all managed windows.
virtual void updateStickyScreenPins(const std::function< bool(const QString &)> &isWindowSticky)
Definition IPlacementEngine.h:1067
virtual void reapplyManagedWindowAppearance()
Re-drive the compositor's per-window appearance (border, hidden title bar) for every window this engi...
Definition IPlacementEngine.h:338
virtual void setCurrentDesktop(int desktop)
Definition IPlacementEngine.h:1034
virtual void cancelDragInsertPreview()
Definition IPlacementEngine.h:582
virtual void loadState()=0
virtual void pruneStatesForDesktop(int removedDesktop)
Definition IPlacementEngine.h:1075
virtual void pushToEmptyZone(const NavigationContext &ctx)=0
Move the focused window to the first empty slot.
virtual void markModeSpecificFloated(const QString &windowId)
Definition IPlacementEngine.h:504
virtual void decreaseMasterCount()
Definition IPlacementEngine.h:1183
virtual void setInteractiveDragWindow(const QString &windowId)
The window currently under a compositor interactive move (the whole drag, preview or not).
Definition IPlacementEngine.h:735
virtual void endArrivalBurst()
Definition IPlacementEngine.h:197
virtual bool claimCrossScreenReopen(const QString &windowId, const QString &openingScreenId, int minWidth=0, int minHeight=0)
OPTIONAL: cross-screen session reclaim, the tiling-engine counterpart of the snap engine's recorded-s...
Definition IPlacementEngine.h:137
virtual QSet< int > desktopsWithActiveState() const
Definition IPlacementEngine.h:1071
IPlacementEngine & operator=(const IPlacementEngine &)=delete
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 scre...
Definition IPlacementEngine.h:717
virtual DragInsertTarget computeDragInsertTargetAtPoint(const QString &screenId, const QPoint &cursorPos) const
Compute the drop target for a cursor position on a managed screen.
Definition IPlacementEngine.h:605
virtual void updateDragInsertPreview(const DragInsertTarget &target)
Update the drop target for an active drag-insert preview.
Definition IPlacementEngine.h:616
virtual QStringList managedWindowOrder(const QString &screenId) const
Definition IPlacementEngine.h:394
virtual int stickyPinnedDesktopForScreen(const QString &screenId) const
The desktop this engine has PINNED screenId to, or 0 when it has not pinned it (which is the normal c...
Definition IPlacementEngine.h:436
virtual QVariantMap perScreenOverrides(const QString &screenId) const
Definition IPlacementEngine.h:487
virtual QString managedFocusedWindow(const QString &screenId) const
The window this engine considers focused on screenId, or empty.
Definition IPlacementEngine.h:412
virtual void setInitialFocusedWindow(const QString &screenId, const QString &windowId)
Hand the incoming engine the focus captured from the outgoing one.
Definition IPlacementEngine.h:457
virtual void pruneStatesForActivities(const QStringList &validActivities)
Definition IPlacementEngine.h:1079
virtual std::optional< WindowPlacement > capturePlacement(const QString &windowId) const
Report windowId's CURRENT placement for persistence, or nullopt if this engine does not manage it.
Definition IPlacementEngine.h:362
virtual void switchFocusBetweenFloatingAndTiling(const QString &screenId)
Jump focus between the float layer and the engine's placement layer (niri's switch-focus-between-floa...
Definition IPlacementEngine.h:271
Per-screen placement state contract.
Definition IPlacementState.h:28
Definition EngineTypes.h:14
Where a drag-insert preview should place the dragged window, in the TARGET ENGINE's slot vocabulary.
Definition IPlacementEngine.h:543
bool isValid() const
Definition IPlacementEngine.h:549
bool operator==(const DragInsertTarget &other) const =default
Context for a cross-engine window handoff.
Definition IPlacementEngine.h:872
QString fromEngineId
source engine identity ("snap" / "autotile" / "scrolling" / "")
Definition IPlacementEngine.h:874
QSize minSize
minimum size as the SOURCE engine models it (0x0 when unknown) — autotile stores it screen-capped,...
Definition IPlacementEngine.h:883
QRect sourceGeometry
window's frame at handoff time (for size preservation)
Definition IPlacementEngine.h:882
QPoint dropPos
cursor position at drop, or invalid for non-drag handoffs
Definition IPlacementEngine.h:881
QString toScreenId
destination screen (must be owned by to engine)
Definition IPlacementEngine.h:875
QStringList sourceZoneIds
zones the window held at source (empty if not snapped)
Definition IPlacementEngine.h:892
QString windowId
Definition IPlacementEngine.h:873
Target window + screen for a navigation or lifecycle operation.
Definition NavigationContext.h:18
One window's single, authoritative placement record — the unit of the unified, engine-agnostic restor...
Definition WindowPlacement.h:68