7#include <PhosphorShell/phosphorshell_export.h>
19#include <QVariantList>
25class QDBusServiceWatcher;
118 [[nodiscard]]
int mode() const;
122 [[nodiscard]] QVariantList
cells() const;
129 [[nodiscard]] QVariantMap
lens() const;
141 Q_INVOKABLE QRect
cellRect(const QString&
id) const;
155 Q_INVOKABLE
void moveCell(const QString& fromId, const QString& toId);
172 Q_INVOKABLE
void registerDropProxy(const QRect& miniatureScreenRect, const QVariantList& cellScreenRects);
236 void resolveScreenId();
237 void fetchDeviceScale();
238 void fetchModeData();
239 void fetchSnappingLayout();
241 void fetchVisibleStrip();
242 void stripFetchFinished();
243 void fetchCurrentTiles();
248 void rebuildFromSource();
249 void setMode(
int mode);
251 void schedulePublish();
254 void activateWindow(const QString& windowId);
255 void setWindowFloating(const QString& windowId);
256 void fetchSnappingMenu();
257 void fetchTilingMenu();
258 void fetchScrollingMenu();
259 void setMenu(const QVariantList& menu);
260 void runVerb(const QString&
id);
261 [[nodiscard]] QString verbTargetWindowId() const;
263 void fetchPinnedMode();
264 void fetchPinnedSnappingLayout();
265 void fetchDesktopWindows();
267 void clearPinnedSource();
268 void sendDropProxy(const QString& json);
269 [[nodiscard]]
int wireDesktop() const;
271 [[nodiscard]] QString effectiveFocusedWindowId() const;
276 template<typename Reply, typename Fn, typename ErrFn>
277 void call(const QString& interface, const QString& method, const QVariantList& args, Fn&& onReply, ErrFn&& onError);
278 template<typename Reply, typename Fn>
279 void call(const QString& interface, const QString& method, const QVariantList& args, Fn&& onReply);
282 QString m_screenName;
285 int m_pinnedDesktop = -1;
290 QStringList m_pinnedWindowIds;
291 QTimer m_pinnedRefetch;
296 QTimer m_stripRefetch;
297 bool m_stripFetchInFlight = false;
298 bool m_stripRefetchWanted = false;
303 QTimer m_modeRefetch;
307 QRect m_screenGeometry;
312 QString m_focusedWindowId;
313 bool m_focusFromDaemon = false;
316 int m_generation = 0;
322 int m_menuGeneration = 0;
324 QString m_dropProxyJson;
332 bool m_sourceVertical = false;
333 int m_sourceOverflowLeft = 0;
334 int m_sourceOverflowRight = 0;
335 int m_sourceStripExtentPx = 0;
341 QVariantList m_cells;
342 QVariantList m_windows;
344 QRect m_publishedWorkArea;
345 qreal m_aspect = 0.0;
346 int m_overflowLeft = 0;
347 int m_overflowRight = 0;
348 int m_stripExtentPx = 0;
349 int m_desktopCount = 0;
350 int m_currentDesktop = -1;
351 bool m_urgent = false;
360 qreal m_deviceScale = 0.0;
422 [[nodiscard]]
const QHash<QString, PlacementMapParser::WindowMeta>&
windowMetadata()
const;
436 struct WindowOccupancy
449 bool stripModel =
true;
450 bool currentTiles =
true;
451 bool focusQuery =
true;
452 bool focusColumnAt =
true;
453 bool scrollViewByPx =
true;
454 bool windowMetadata =
true;
455 bool urgentWindows =
true;
456 bool activateWindow =
true;
457 bool setWindowFloatingForScreen =
true;
458 bool moveWindowToDesktop =
true;
459 bool moveColumnTo =
true;
460 bool dropProxy =
true;
461 bool windowStatesForDesktop =
true;
464 void setAvailable(
bool available);
465 void seedWindowStates();
466 void seedUrgentWindows();
468 void applyWindowState(
const QString& windowId,
const QString& screenId,
const QStringList& zoneIds,
bool floating);
469 void forEachScreen(
void (PlacementMapScreen::*fn)());
471 [[nodiscard]]
static QString screenKey(
const QString& screenName,
int desktopIndex);
474 void requestMetadata(
const QString& windowId);
477 void noteReferencedWindows(PlacementMapScreen* screen,
const QSet<QString>& windowIds);
478 void pruneMetadata();
480 PlacementMapBus* m_bus =
nullptr;
481 QDBusServiceWatcher* m_watcher =
nullptr;
482 Workspaces* m_workspaces =
nullptr;
485 QHash<QString, PlacementMapScreen*> m_screens;
486 QHash<QString, WindowOccupancy> m_occupancy;
487 quint64 m_occupancySeq = 0;
488 QString m_focusedWindowId;
490 QHash<QString, PlacementMapParser::WindowMeta> m_metadata;
491 QSet<QString> m_metadataPending;
492 QHash<PlacementMapScreen*, QSet<QString>> m_referenced;
493 QSet<QString> m_urgent;
496 bool m_available =
false;
One screen's view of the placement engine, in work-area fractions.
Definition PlacementMap.h:78
void serviceLost()
The daemon left the bus: mode -1, no cells.
void tileBatchReceived(const QList< PlacementMapParser::TileRect > &tiles)
A windowsTileRequested batch arrived; ignored unless it names us.
QString focusedCellId() const
The id of the cell holding the focused window, or empty.
QVariantList cells() const
void moveNavigationWindowToDesktop(const QString &windowId, int index)
Move any window in the navigation model, including offscreen columns.
int overflowRight() const
void unregisterDropProxy()
Withdraw the drop proxy, if one is registered.
void tilingChanged()
Tiling.tilingChanged for this screen.
void focusedWindowChanged(const QString &windowId)
Tiling.focusedWindowChanged for this screen: the engine's own focus, which supersedes the singleton's...
void scrollView(int delta)
Wheel over the map.
void refreshMenu()
Re-fetch menuModel for the current mode.
void moveCell(const QString &fromId, const QString &toId)
Drag of one cell onto another (A2 §1.5).
int pinnedDesktop() const
Mode
Definition PlacementMap.h:100
@ None
Definition PlacementMap.h:101
@ Tiling
Definition PlacementMap.h:103
@ Scrolling
Definition PlacementMap.h:104
@ Snapping
Definition PlacementMap.h:102
int stripExtentPx() const
void switchDesktop(int index)
Switch to the desktop at this 0-based row of Workspaces.model.
void refreshGeometry()
Re-read the work area, the screen origin and the output's scale.
void occupancyChanged()
Occupancy (snapping) or focus (any mode) changed upstream.
void scrollViewByPx(int px)
Drag of the lens: pan the strip's view by px in strip space (Scrolling.scrollViewByPx).
void stripChanged()
Scrolling.stripChanged / stripContextChanged for this screen.
void toggleFloat(const QString &id)
Middle-click: float the cell's window.
PlacementMapScreen(const QString &screenName, PlacementMap *parent)
QVariantList menuModel() const
bool layoutsAvailable() const
void placeNavigationWindowInZone(const QString &windowId, const QString &zoneId)
void desktopCountChanged()
void refreshMode()
Re-read the mode for the current (screen, desktop, activity).
void layoutsAvailableChanged()
QRect cellRect(const QString &id) const
The cell's rect in this screen's logical coordinates, origin at its top-left (work-area fractions sca...
void activate(const QString &id)
Click on a cell.
void registerDropProxy(const QRect &miniatureScreenRect, const QVariantList &cellScreenRects)
Register the miniature as a drop proxy for the compositor's own window drag (WindowDrag....
void changed()
Coalesced: once per event-loop turn after any of the above.
void setPlacementMode(int mode)
QVariantList windows() const
void reseed()
Forget everything and re-resolve from the daemon.
int currentDesktop() const
void windowStatesChanged()
WindowTracking.windowStateChanged landed in the singleton's table (or the table was re-seeded).
void stripExtentChanged()
void applyMenuChoice(const QString &kind, const QString &id)
Apply one menuModel entry: assign the layout / algorithm / template to this screen and desktop,...
void activateNavigationWindow(const QString &windowId)
Activate a window from the complete navigation model.
void moveToDesktop(const QString &id, int index)
Move the cell's window to the desktop at this 0-based row of Workspaces.model (WindowTracking....
QString screenName() const
void currentDesktopChanged()
QML singleton: the placement engine's geometry per screen.
Definition PlacementMap.h:378
const QSet< QString > & urgentWindows() const
Windows demanding attention (getUrgentWindows seeded, then windowUrgencyChanged).
PhosphorShell::PlacementMapScreen * forScreen(const QString &screenName)
The map for a QScreen name (PanelWindow.screen.name).
QString currentActivity() const
The current activity id (LayoutRegistry.getCurrentActivity).
QHash< QString, QStringList > occupancyForScreen(const QString &screenId) const
windowId → zone ids for non-floating windows on screenId.
friend class PlacementMapScreen
Definition PlacementMap.h:434
PlacementMap(QObject *parent=nullptr)
Whether the daemon is on the session bus right now.
QString focusedWindowId() const
The window the daemon last asked the compositor to focus or activate, or empty.
static PlacementMap * create(QQmlEngine *engine, QJSEngine *scriptEngine)
QML-singleton factory hook.
QList< PlacementMapParser::Occupant > occupantsForScreen(const QString &screenId) const
The non-floating windows on screenId, oldest state change first, so the last occupant of a zone is it...
PhosphorShell::PlacementMapScreen * forScreenDesktop(const QString &screenName, int desktopIndex)
The map for a QScreen name pinned to the 0-based desktopIndex (a row of Workspaces....
Workspaces * workspaces() const
const QHash< QString, PlacementMapParser::WindowMeta > & windowMetadata() const
WindowTracking.getWindowMetadata answers so far, by window id.
QML singleton exposing the compositor's workspaces.
Definition Workspaces.h:111
D-Bus marshalling for the shared tiling-family value types (see AutotileTypes.h; the file names preda...
Definition AutotileMarshalling.h:19
Definition PlacementMapParser.h:18
Definition Environment.h:11