Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PlacementEngineBase.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
8#include <phosphorengine_export.h>
9
10#include <QObject>
11#include <QPointer>
12#include <QRect>
13#include <QSet>
14#include <QString>
15#include <QStringList>
16
17namespace PhosphorEngine {
18
29class PHOSPHORENGINE_EXPORT PlacementEngineBase : public QObject, public IPlacementEngine
30{
31 Q_OBJECT
32
33public:
37 virtual int pruneStaleWindows(const QSet<QString>& aliveWindowIds);
38
39 // ═══════════════════════════════════════════════════════════════════════════
40 // Settings — universal pattern for all engines
41 //
42 // The daemon calls setEngineSettings() once at startup with a QObject*
43 // that implements the engine's specific settings interface (e.g.
44 // IAutotileSettings, ISnapSettings). Engines qobject_cast at point of
45 // use to their interface type. No caching, no bridge, no signal wiring
46 // inside the engine — the daemon handles change signals externally.
47 // ═══════════════════════════════════════════════════════════════════════════
48
49 void setEngineSettings(QObject* settings);
50 QObject* engineSettings() const
51 {
52 return m_engineSettings;
53 }
54
55 // Public dtor required for unique_ptr<PlacementEngineBase> in Daemon.
57
58protected:
59 explicit PlacementEngineBase(QObject* parent = nullptr);
60
61Q_SIGNALS:
62 void geometryRestoreRequested(const QString& windowId, const QRect& geometry, const QString& screenId);
63
64 void navigationFeedback(bool success, const QString& action, const QString& reason, const QString& sourceId,
65 const QString& targetId, const QString& screenId);
66 void windowFloatingChanged(const QString& windowId, bool floating, const QString& screenId);
67 void activateWindowRequested(const QString& windowId);
68
73 void windowDesktopMoveRequested(const QString& windowId, int desktop);
74
86 void windowOutputMoveExpected(const QString& windowId, const QString& targetScreenId);
87
98 void crossModeMoveRequested(const QString& windowId, const QString& targetScreenId, int targetDesktop,
99 const QString& direction);
100
110 void crossModeSwapRequested(const QString& windowId, const QString& targetScreenId, int targetDesktop,
111 const QString& direction);
112
115 void windowFloatingStateSynced(const QString& windowId, bool floating, const QString& screenId);
116
118 void windowsBatchFloated(const QStringList& windowIds, const QString& screenId);
119
121 void algorithmChanged(const QString& algorithmId);
122
124 void placementChanged(const QString& screenId);
125
127 void windowsReleased(const QStringList& windowIds, const QSet<QString>& releasedScreenIds);
128
132
133private:
134 QPointer<QObject> m_engineSettings;
135};
136
137} // namespace PhosphorEngine
Unified placement engine interface.
Definition IPlacementEngine.h:61
Abstract base class for placement engines.
Definition PlacementEngineBase.h:30
void windowOutputMoveExpected(const QString &windowId, const QString &targetScreenId)
Emitted when daemon-initiated directional navigation moves a window across physical outputs: the engi...
void setEngineSettings(QObject *settings)
void windowFloatingStateSynced(const QString &windowId, bool floating, const QString &screenId)
Emitted to sync floating state without restoring geometry.
void windowFloatingChanged(const QString &windowId, bool floating, const QString &screenId)
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 th...
void algorithmChanged(const QString &algorithmId)
Emitted when the active tiling algorithm changes.
void geometryRestoreRequested(const QString &windowId, const QRect &geometry, const QString &screenId)
void windowDesktopMoveRequested(const QString &windowId, int desktop)
Emitted when directional navigation moves a window across virtual desktops: the engine has already re...
void activateWindowRequested(const QString &windowId)
PlacementEngineBase(QObject *parent=nullptr)
void placementChanged(const QString &screenId)
Emitted when the placement layout changes for a screen.
virtual int pruneStaleWindows(const QSet< QString > &aliveWindowIds)
Drop any per-engine bookkeeping for windows not in aliveWindowIds.
void settingsPersistRequested()
Emitted when the engine writes tuning values back to the settings object and wants the daemon to pers...
void windowsReleased(const QStringList &windowIds, const QSet< QString > &releasedScreenIds)
Emitted when windows are released from engine management.
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 th...
void navigationFeedback(bool success, const QString &action, const QString &reason, const QString &sourceId, const QString &targetId, const QString &screenId)
void windowsBatchFloated(const QStringList &windowIds, const QString &screenId)
Emitted when overflow windows are batch-floated during applyTiling.
QObject * engineSettings() const
Definition PlacementEngineBase.h:50
Definition EngineTypes.h:13