Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
IPlacementEngine.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4// FILE-SIZE EXCEPTION (sanctioned): one interface, one header. The whole
5// file is a single abstract class — the placement-engine contract every
6// engine implements and the daemon dispatches against — and C++ cannot
7// split one class's members across headers. Extracting groups of virtuals
8// into secondary bases would change the contract's shape (and every
9// implementer and mock) purely to satisfy a line count.
10
11#pragma once
12
13#include <phosphorengine_export.h>
14
18
19#include <QPoint>
20#include <QRect>
21#include <QSize>
22#include <QSet>
23#include <QString>
24#include <QStringList>
25#include <QVariantMap>
26
27#include <functional>
28#include <optional>
29
30class QObject;
31
32namespace PhosphorEngine {
33
34class ICrossSurfaceResolver;
35
71class PHOSPHORENGINE_EXPORT IPlacementEngine
72{
73protected:
74 IPlacementEngine() = default;
75
76public:
77 virtual ~IPlacementEngine() = default;
78 // Polymorphic base: never copied or moved (every concrete engine is a
79 // QObject anyway; this makes slicing a compile error at the interface).
82
83 // ═══════════════════════════════════════════════════════════════════════════
84 // Screen ownership
85 // ═══════════════════════════════════════════════════════════════════════════
86
88 virtual bool isActiveOnScreen(const QString& screenId) const = 0;
89
90 // ═══════════════════════════════════════════════════════════════════════════
91 // Window lifecycle
92 // ═══════════════════════════════════════════════════════════════════════════
93
95 virtual void windowOpened(const QString& windowId, const QString& screenId, int minWidth = 0,
96 int minHeight = 0) = 0;
97
108 void windowOpened(const QString& windowId, const QString& screenId)
109 {
110 windowOpened(windowId, screenId, 0, 0);
111 }
112
137 virtual bool claimCrossScreenReopen(const QString& windowId, const QString& openingScreenId, int minWidth = 0,
138 int minHeight = 0)
139 {
140 Q_UNUSED(windowId)
141 Q_UNUSED(openingScreenId)
142 Q_UNUSED(minWidth)
143 Q_UNUSED(minHeight)
144 return false;
145 }
146
172 virtual QString heldScreenForWindow(const QString& windowId) const
173 {
174 Q_UNUSED(windowId)
175 return {};
176 }
177
194 virtual void beginArrivalBurst()
195 {
196 }
197 virtual void endArrivalBurst()
198 {
199 }
200
202 virtual void windowClosed(const QString& windowId) = 0;
203
207 virtual void windowFocused(const QString& windowId, const QString& screenId) = 0;
208
209 // ═══════════════════════════════════════════════════════════════════════════
210 // Float management (explicit window ID)
211 //
212 // These take a concrete window ID — used by the D-Bus adaptor and
213 // engine-internal paths that already know which window to act on.
214 // toggleFocusedFloat() in the Navigation section is the user-intent
215 // entry point that resolves the focused window from NavigationContext.
216 // ═══════════════════════════════════════════════════════════════════════════
217
219 virtual void toggleWindowFloat(const QString& windowId, const QString& screenId) = 0;
220
234 virtual void setWindowFloat(const QString& windowId, bool shouldFloat, const QString& screenId = QString()) = 0;
235
236 // ═══════════════════════════════════════════════════════════════════════════
237 // Navigation (user intents)
238 // ═══════════════════════════════════════════════════════════════════════════
239
241 virtual void focusInDirection(const QString& direction, const NavigationContext& ctx) = 0;
242
244 virtual void moveFocusedInDirection(const QString& direction, const NavigationContext& ctx) = 0;
245
253 virtual void spanFocusedInDirection(const QString& direction, const NavigationContext& ctx)
254 {
255 Q_UNUSED(direction)
256 Q_UNUSED(ctx)
257 }
258
271 virtual void switchFocusBetweenFloatingAndTiling(const QString& screenId)
272 {
273 Q_UNUSED(screenId)
274 }
275
277 virtual void swapFocusedInDirection(const QString& direction, const NavigationContext& ctx) = 0;
278
280 virtual void moveFocusedToPosition(int position, const NavigationContext& ctx) = 0;
281
283 virtual void rotateWindows(bool clockwise, const NavigationContext& ctx) = 0;
284
286 virtual void reapplyLayout(const NavigationContext& ctx) = 0;
287
292 virtual void snapAllWindows(const NavigationContext& ctx) = 0;
293
295 virtual void cycleFocus(bool forward, const NavigationContext& ctx) = 0;
296
302 virtual void pushToEmptyZone(const NavigationContext& ctx) = 0;
303
305 virtual void restoreFocusedWindow(const NavigationContext& ctx) = 0;
306
308 virtual void toggleFocusedFloat(const NavigationContext& ctx) = 0;
309
310 // ═══════════════════════════════════════════════════════════════════════════
311 // OPTIONAL: Screen management (override if engine tracks multi-screen state)
312 // ═══════════════════════════════════════════════════════════════════════════
313
314 virtual QSet<QString> activeScreens() const
315 {
316 return {};
317 }
318 virtual void setActiveScreens(const QSet<QString>& screens)
319 {
320 Q_UNUSED(screens)
321 }
322
323 // ═══════════════════════════════════════════════════════════════════════════
324 // OPTIONAL: Window-appearance re-application (compositor reconnect)
325 // ═══════════════════════════════════════════════════════════════════════════
326
339 {
340 }
341
342 // ═══════════════════════════════════════════════════════════════════════════
343 // OPTIONAL: Unified placement capture/restore (engine-agnostic restore model)
344 //
345 // The single seam for the unified WindowPlacement restore model. An engine
346 // implements exactly these two methods to participate in save+restore; a new
347 // engine (e.g. the scrolling engine) needs no core/schema change — it keys
348 // its own EngineSlot (state token + slot reference) under its engineId() in the
349 // single per-window record and reads/writes the shared freeGeometryByScreen.
350 // ═══════════════════════════════════════════════════════════════════════════
351
362 virtual std::optional<WindowPlacement> capturePlacement(const QString& windowId) const
363 {
364 Q_UNUSED(windowId)
365 return std::nullopt;
366 }
367
383 virtual bool restorePlacement(const WindowPlacement& placement, const QString& screenId)
384 {
385 Q_UNUSED(placement)
386 Q_UNUSED(screenId)
387 return false;
388 }
389
390 // ═══════════════════════════════════════════════════════════════════════════
391 // OPTIONAL: Window ordering and focus (mode-transition capture and seed)
392 // ═══════════════════════════════════════════════════════════════════════════
393
394 virtual QStringList managedWindowOrder(const QString& screenId) const
395 {
396 Q_UNUSED(screenId)
397 return {};
398 }
399 virtual void setInitialWindowOrder(const QString& screenId, const QStringList& windowIds)
400 {
401 Q_UNUSED(screenId)
402 Q_UNUSED(windowIds)
403 }
404
412 virtual QString managedFocusedWindow(const QString& screenId) const
413 {
414 Q_UNUSED(screenId)
415 return {};
416 }
436 virtual int stickyPinnedDesktopForScreen(const QString& screenId) const
437 {
438 Q_UNUSED(screenId)
439 return 0;
440 }
457 virtual void setInitialFocusedWindow(const QString& screenId, const QString& windowId)
458 {
459 Q_UNUSED(screenId)
460 Q_UNUSED(windowId)
461 }
462
463 // ═══════════════════════════════════════════════════════════════════════════
464 // OPTIONAL: Per-screen config (override if engine supports per-screen overrides)
465 //
466 // SCOPE IS THE IMPLEMENTATION'S CHOICE, and the two in-tree engines differ.
467 // AutotileEngine stores one map per SCREEN. ScrollEngine stores one per
468 // (screen, desktop, activity) and answers for the screen's CURRENT context,
469 // because its templates are resolved per context and keying by screen let
470 // one desktop's template overwrite another's. A caller holding this
471 // interface must therefore not assume a map it pushed survives a desktop or
472 // activity switch, nor that the accessor replays what it last wrote.
473 // clearPerScreenConfig is the whole-SCREEN door in both: it drops every
474 // context's entry, so an engine keyed per context needs an empty
475 // applyPerScreenConfig push, not a clear, to say "this context has none".
476 // ═══════════════════════════════════════════════════════════════════════════
477
478 virtual void applyPerScreenConfig(const QString& screenId, const QVariantMap& overrides)
479 {
480 Q_UNUSED(screenId)
481 Q_UNUSED(overrides)
482 }
483 virtual void clearPerScreenConfig(const QString& screenId)
484 {
485 Q_UNUSED(screenId)
486 }
487 virtual QVariantMap perScreenOverrides(const QString& screenId) const
488 {
489 Q_UNUSED(screenId)
490 return {};
491 }
492
493 // ═══════════════════════════════════════════════════════════════════════════
494 // OPTIONAL: Mode-specific float MARKER (runtime discriminator, NOT persistence)
495 //
496 // Distinguishes a USER float in this engine's mode from an incidental float
497 // (e.g. autotile overflow). It is live runtime state the capture funnel reads
498 // to decide whether a float should persist into the record — there is no
499 // parallel "saved floats" store; the WindowPlacement record is the single
500 // source of truth for cross-mode float state. All three verbs live here,
501 // in one section (mark / query / clear).
502 // ═══════════════════════════════════════════════════════════════════════════
503
504 virtual void markModeSpecificFloated(const QString& windowId)
505 {
506 Q_UNUSED(windowId)
507 }
508 virtual bool isModeSpecificFloated(const QString& windowId) const
509 {
510 Q_UNUSED(windowId)
511 return false;
512 }
513 virtual void clearModeSpecificFloatMarker(const QString& windowId)
514 {
515 Q_UNUSED(windowId)
516 }
517
518 // ═══════════════════════════════════════════════════════════════════════════
519 // OPTIONAL: Drag insert preview (override if engine supports drag-to-insert)
520 // ═══════════════════════════════════════════════════════════════════════════
521
543 {
544 int primary = -1;
545 int secondary = -1;
546 bool newSlot = false;
547 bool leadingEdge = false;
548
549 bool isValid() const
550 {
551 return primary >= 0;
552 }
553 bool operator==(const DragInsertTarget& other) const = default;
554 };
555
556 // Contract shared by the preview verbs, which the two implementations
557 // honour with OPPOSITE internal shapes:
558 // - begin MAY mutate managed state, and MAY adopt the window from
559 // another screen, from a floating set, or from untracked entirely
560 // (both engines do all three).
561 // - an engine may or may not keep the window MANAGED while its preview
562 // is live — autotile keeps it a tile and restructures per update;
563 // scrolling DETACHES it until commit. Cross-engine callers must not
564 // use isWindowTiled/isWindowManaged as a drag-state probe.
565 // - begin on an engine already holding a preview cancels the old one
566 // first; commit/cancel are no-ops with no preview live; and
567 // dragInsertPreviewScreenId is empty with no preview live.
568
569 virtual bool hasDragInsertPreview() const
570 {
571 return false;
572 }
573 virtual bool beginDragInsertPreview(const QString& windowId, const QString& screenId)
574 {
575 Q_UNUSED(windowId)
576 Q_UNUSED(screenId)
577 return false;
578 }
580 {
581 }
583 {
584 }
585 virtual QString dragInsertPreviewScreenId() const
586 {
587 return {};
588 }
589
598 virtual QString dragInsertPreviewPriorScreenId() const
599 {
600 return {};
601 }
602
605 virtual DragInsertTarget computeDragInsertTargetAtPoint(const QString& screenId, const QPoint& cursorPos) const
606 {
607 Q_UNUSED(screenId)
608 Q_UNUSED(cursorPos)
609 return {};
610 }
611
616 virtual void updateDragInsertPreview(const DragInsertTarget& target)
617 {
618 Q_UNUSED(target)
619 }
620
646 virtual bool dragAutoScrollTick(const QString& screenId, const QPoint& cursorPos, qreal dtSeconds)
647 {
648 Q_UNUSED(screenId)
649 Q_UNUSED(cursorPos)
650 Q_UNUSED(dtSeconds)
651 return false;
652 }
653
669 virtual bool dragAutoScrollActive() const
670 {
671 return false;
672 }
673
683 virtual void cancelDragAutoScroll()
684 {
685 }
686
717 virtual QRect dragInsertIndicatorRect(const QString& screenId) const
718 {
719 Q_UNUSED(screenId)
720 return {};
721 }
722
735 virtual void setInteractiveDragWindow(const QString& windowId)
736 {
737 Q_UNUSED(windowId)
738 }
739
740 // ═══════════════════════════════════════════════════════════════════════════
741 // OPTIONAL: Per-window tracking state
742 //
743 // What the daemon asks an engine about ONE window: does it track it, does
744 // it manage/tile it, which screen does it think the window is on, what min
745 // size does it model — plus the two per-window updates that follow from
746 // those answers (a late min-size discovery, an interactive resize). The
747 // drag-preview verbs above are a separate group; these have nothing to do
748 // with a drag.
749 // ═══════════════════════════════════════════════════════════════════════════
750
751 virtual bool isWindowTracked(const QString& windowId) const
752 {
753 Q_UNUSED(windowId)
754 return false;
755 }
765 virtual bool isWindowManaged(const QString& windowId) const
766 {
767 Q_UNUSED(windowId)
768 return false;
769 }
770
773 virtual bool isWindowTiled(const QString& windowId) const
774 {
775 Q_UNUSED(windowId)
776 return false;
777 }
778
789 virtual QString screenForTrackedWindow(const QString& windowId) const
790 {
791 Q_UNUSED(windowId)
792 return {};
793 }
794
805 virtual QSize windowMinimumSize(const QString& windowId) const
806 {
807 Q_UNUSED(windowId)
808 return {};
809 }
810
816 virtual void windowMinSizeUpdated(const QString& windowId, int minWidth, int minHeight)
817 {
818 Q_UNUSED(windowId)
819 Q_UNUSED(minWidth)
820 Q_UNUSED(minHeight)
821 }
822
832 virtual void onWindowResized(const QString& windowId, const QRect& oldFrame, const QRect& newFrame,
833 const QString& screenId)
834 {
835 Q_UNUSED(windowId)
836 Q_UNUSED(oldFrame)
837 Q_UNUSED(newFrame)
838 Q_UNUSED(screenId)
839 }
840
841 // ═══════════════════════════════════════════════════════════════════════════
842 // Cross-engine handoff
843 //
844 // When a window crosses screens whose owning engines differ (e.g. a snap
845 // screen → an autotile screen, via drag drop), ownership has to transfer
846 // between two engines. Without an explicit contract, each engine makes
847 // local guesses (autotile's "is this a floating window I should adopt?"
848 // branch, snap's "do I know this window?" early-return) and the daemon
849 // misroutes user intents during the transition window.
850 //
851 // The handoff is a two-step transaction the daemon orchestrates:
852 // 1. fromEngine->handoffRelease(windowId)
853 // 2. toEngine->handoffReceive(ctx)
854 //
855 // Each engine's release is a tracking-only clear (no geometry mutation —
856 // the receiving engine places the window). Each engine's receive applies
857 // its own placement policy (autotile picks an insert slot or floats;
858 // snap picks the nearest zone or floats) using the context fields.
859 //
860 // Engines that don't currently distinguish ownership across screens can
861 // leave both as no-ops; the defaults are safe.
862 //
863 // The verbs are prefixed `handoff*` to keep them distinct from an engine
864 // dropping a window entirely (the window is no longer engine-managed at all
865 // — a different concept from "transferring ownership to another engine").
866 // ═══════════════════════════════════════════════════════════════════════════
867
872 {
873 QString windowId;
874 QString fromEngineId;
875 QString toScreenId;
876 int toDesktop = 0;
881 QPoint dropPos;
883 QSize minSize;
892 QStringList sourceZoneIds;
893 bool wasFloating = false;
894 bool heldFocus = false;
901 int insertIndex = -1;
909 };
910
925 virtual void handoffReceive(const HandoffContext& ctx)
926 {
927 Q_UNUSED(ctx)
928 }
929
942 virtual void handoffRelease(const QString& windowId)
943 {
944 Q_UNUSED(windowId)
945 }
946
950 virtual QString engineId() const
951 {
952 return {};
953 }
954
955 // ═══════════════════════════════════════════════════════════════════════════
956 // OPTIONAL: Layout capability (UI-facing; distinct from algorithm identity)
957 // ═══════════════════════════════════════════════════════════════════════════
958
964 enum class LayoutSupport {
968 None,
971 Placement,
981 Templates
982 };
983
986 {
987 return LayoutSupport::None;
988 }
989
1000 virtual bool providesDragInsertSelector() const
1001 {
1002 return false;
1003 }
1004
1005 // ═══════════════════════════════════════════════════════════════════════════
1006 // OPTIONAL: Algorithm / mode identity (override if engine has switchable algorithms)
1007 // ═══════════════════════════════════════════════════════════════════════════
1008
1009 virtual QString algorithmId() const
1010 {
1011 return {};
1012 }
1013 virtual void setAlgorithm(const QString& algorithmId)
1014 {
1015 Q_UNUSED(algorithmId)
1016 }
1017 virtual bool isEnabled() const noexcept
1018 {
1019 return false;
1020 }
1021 virtual QString activeScreen() const
1022 {
1023 return {};
1024 }
1025 virtual void setActiveScreenHint(const QString& screenId)
1026 {
1027 Q_UNUSED(screenId)
1028 }
1029
1030 // ═══════════════════════════════════════════════════════════════════════════
1031 // OPTIONAL: Desktop/activity context (override if engine is desktop-aware)
1032 // ═══════════════════════════════════════════════════════════════════════════
1033
1034 virtual void setCurrentDesktop(int desktop)
1035 {
1036 Q_UNUSED(desktop)
1037 }
1044 virtual void setCurrentDesktopForScreen(const QString& screenId, int desktop)
1045 {
1046 Q_UNUSED(screenId)
1047 Q_UNUSED(desktop)
1048 }
1050 virtual void clearCurrentDesktopForScreen(const QString& screenId)
1051 {
1052 Q_UNUSED(screenId)
1053 }
1054 virtual void setCurrentActivity(const QString& activity)
1055 {
1056 Q_UNUSED(activity)
1057 }
1064 {
1065 Q_UNUSED(resolver)
1066 }
1067 virtual void updateStickyScreenPins(const std::function<bool(const QString&)>& isWindowSticky)
1068 {
1069 Q_UNUSED(isWindowSticky)
1070 }
1071 virtual QSet<int> desktopsWithActiveState() const
1072 {
1073 return {};
1074 }
1075 virtual void pruneStatesForDesktop(int removedDesktop)
1076 {
1077 Q_UNUSED(removedDesktop)
1078 }
1079 virtual void pruneStatesForActivities(const QStringList& validActivities)
1080 {
1081 Q_UNUSED(validActivities)
1082 }
1094 virtual void pruneStatesForRemovedScreen(const QString& physicalScreenId)
1095 {
1096 Q_UNUSED(physicalScreenId)
1097 }
1098
1099 // ═══════════════════════════════════════════════════════════════════════════
1100 // OPTIONAL: Settings synchronization (override if engine caches config)
1101 // ═══════════════════════════════════════════════════════════════════════════
1102
1109 {
1110 }
1113 static constexpr qreal kDefaultSplitRatioStep = 0.05;
1114 virtual qreal effectiveSplitRatioStep(const QString& screenId) const
1115 {
1116 Q_UNUSED(screenId)
1117 return kDefaultSplitRatioStep;
1118 }
1122 virtual int runtimeMaxWindows() const
1123 {
1124 return -1;
1125 }
1133 virtual std::optional<int> savedMaxWindowsForAlgorithm(const QString& algorithmId) const
1134 {
1135 Q_UNUSED(algorithmId)
1136 return std::nullopt;
1137 }
1138
1139 // ═══════════════════════════════════════════════════════════════════════════
1140 // OPTIONAL: Retile / refresh (override if engine supports on-demand retile)
1141 // ═══════════════════════════════════════════════════════════════════════════
1142
1143 virtual void retile(const QString& screenId = QString())
1144 {
1145 Q_UNUSED(screenId)
1146 }
1147 virtual void scheduleRetileForScreen(const QString& screenId)
1148 {
1149 Q_UNUSED(screenId)
1150 }
1151
1152 // Per-window restore persistence is unified: engines implement
1153 // capturePlacement()/restorePlacement() (above) and the common
1154 // WindowPlacementStore handles capture timing, serialization, and the single
1155 // WindowPlacements config key. No engine-specific serialize/deserialize hooks.
1156
1157 // ═══════════════════════════════════════════════════════════════════════════
1158 // OPTIONAL: Init hooks (override to receive shared services)
1159 // ═══════════════════════════════════════════════════════════════════════════
1160
1164 virtual void setWindowRegistry(QObject* registry)
1165 {
1166 Q_UNUSED(registry)
1167 }
1168 // ═══════════════════════════════════════════════════════════════════════════
1169 // OPTIONAL: Master operations (autotile-specific, no-op on snap engine)
1170 // ═══════════════════════════════════════════════════════════════════════════
1171
1172 virtual void increaseMasterRatio(qreal delta = kDefaultSplitRatioStep)
1173 {
1174 Q_UNUSED(delta)
1175 }
1176 virtual void decreaseMasterRatio(qreal delta = kDefaultSplitRatioStep)
1177 {
1178 Q_UNUSED(delta)
1179 }
1180 virtual void increaseMasterCount()
1181 {
1182 }
1183 virtual void decreaseMasterCount()
1184 {
1185 }
1186 virtual void focusMaster()
1187 {
1188 }
1190 {
1191 }
1192
1193 // ═══════════════════════════════════════════════════════════════════════════
1194 // Persistence
1195 // ═══════════════════════════════════════════════════════════════════════════
1196
1197 virtual void saveState() = 0;
1198 virtual void loadState() = 0;
1199
1200 // ═══════════════════════════════════════════════════════════════════════════
1201 // State access
1202 // ═══════════════════════════════════════════════════════════════════════════
1203
1209 virtual IPlacementState* stateForScreen(const QString& screenId) = 0;
1210 virtual const IPlacementState* stateForScreen(const QString& screenId) const = 0;
1211};
1212
1213} // namespace PhosphorEngine
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 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.
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 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