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

One screen's view of the placement engine, in work-area fractions. More...

#include <PhosphorShell/PlacementMap.h>

Inheritance diagram for PhosphorShell::PlacementMapScreen:
[legend]

Public Types

enum  Mode { None = -1 , Snapping = 0 , Tiling = 1 , Scrolling = 2 }

Signals

void screenIdChanged ()
void modeChanged ()
void layoutsAvailableChanged ()
void aspectChanged ()
void workAreaChanged ()
void cellsChanged ()
void windowsChanged ()
void lensChanged ()
void overflowChanged ()
void stripExtentChanged ()
void desktopCountChanged ()
void currentDesktopChanged ()
void urgentChanged ()
void menuModelChanged ()
void changed ()
 Coalesced: once per event-loop turn after any of the above.

Public Member Functions

 PlacementMapScreen (const QString &screenName, PlacementMap *parent)
 PlacementMapScreen (const QString &screenName, int desktopIndex, PlacementMap *parent)
 A screen pinned to the 0-based desktopIndex (placementmap_desktop.cpp).
 ~PlacementMapScreen () override
int pinnedDesktop () const
bool isPinned () const
QString screenName () const
QString screenId () const
int mode () const
bool layoutsAvailable () const
qreal aspect () const
QRect workArea () const
QVariantList cells () const
QVariantList windows () const
void activateNavigationWindow (const QString &windowId)
 Activate a window from the complete navigation model.
void moveNavigationWindowToDesktop (const QString &windowId, int index)
 Move any window in the navigation model, including offscreen columns.
void placeNavigationWindowInZone (const QString &windowId, const QString &zoneId)
QVariantMap lens () const
int overflowLeft () const
int overflowRight () const
int stripExtentPx () const
int desktopCount () const
int currentDesktop () const
bool isUrgent () const
QVariantList menuModel () const
QRect cellRect (const QString &id) const
 The cell's rect in this screen's logical coordinates, origin at its top-left (work-area fractions scaled onto workArea), or a null rect for an unknown id.
QString focusedCellId () const
 The id of the cell holding the focused window, or empty.
void activate (const QString &id)
 Click on a cell.
void moveCell (const QString &fromId, const QString &toId)
 Drag of one cell onto another (A2 §1.5).
void toggleFloat (const QString &id)
 Middle-click: float the cell's window.
void moveToDesktop (const QString &id, int index)
 Move the cell's window to the desktop at this 0-based row of Workspaces.model (WindowTracking.moveWindowToDesktop, 1-based on the wire).
void registerDropProxy (const QRect &miniatureScreenRect, const QVariantList &cellScreenRects)
 Register the miniature as a drop proxy for the compositor's own window drag (WindowDrag.registerDropProxy).
void unregisterDropProxy ()
 Withdraw the drop proxy, if one is registered.
void refreshMenu ()
 Re-fetch menuModel for the current mode.
void setPlacementMode (int mode)
void applyMenuChoice (const QString &kind, const QString &id)
 Apply one menuModel entry: assign the layout / algorithm / template to this screen and desktop, or run the verb.
void scrollView (int delta)
 Wheel over the map.
void scrollViewByPx (int px)
 Drag of the lens: pan the strip's view by px in strip space (Scrolling.scrollViewByPx).
void switchDesktop (int index)
 Switch to the desktop at this 0-based row of Workspaces.model.
void reseed ()
 Forget everything and re-resolve from the daemon.
void serviceLost ()
 The daemon left the bus: mode -1, no cells.
void refreshMode ()
 Re-read the mode for the current (screen, desktop, activity).
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 tileBatchReceived (const QList< PlacementMapParser::TileRect > &tiles)
 A windowsTileRequested batch arrived; ignored unless it names us.
void tilingChanged ()
 Tiling.tilingChanged for this screen.
void windowStatesChanged ()
 WindowTracking.windowStateChanged landed in the singleton's table (or the table was re-seeded).
void stripChanged ()
 Scrolling.stripChanged / stripContextChanged for this screen.
void focusedWindowChanged (const QString &windowId)
 Tiling.focusedWindowChanged for this screen: the engine's own focus, which supersedes the singleton's focus-request proxy.
void desktopsChanged ()

Detailed Description

One screen's view of the placement engine, in work-area fractions.

Vended by PlacementMap.forScreen(name) and owned by that singleton; QML never constructs one. Every property has its own NOTIFY, and changed() fires once per event-loop turn after any burst of updates, so a painter can bind the properties and repaint on changed.

mode is 0 snapping, 1 tiling, 2 scrolling, and -1 when the daemon is absent or does not list this screen. cells is a list of maps with id, x, y, w, h, t, occupied, focused, label, zoneNumber, stack, stripT, columnIndex, windowId, appId, title, urgent, where the rect is 0..1 of the work area and t is the hue axis (A2 §1.2). lens is {x, w} in scrolling mode and empty otherwise; stripExtentPx is the strip's length in scrolling mode (0 against a daemon without stripModelJson). urgent is true while any cell demands attention (the rail thickening of A2 §3.3).

menuModel is the right-click menu (A2 §1.5): after refreshMenu() it holds one {kind, id, name, current} map per choice for this mode (kind "layout", "algorithm" or "template") followed by {kind: "verb", id} entries (snapping: editLayout, snapAll; tiling: retile, promoteToMaster; scrolling: toggleMaximizeColumn). applyMenuChoice assigns the choice for this screen and desktop, or runs the verb. promoteToMaster and toggleMaximizeColumn act on the screen's own daemon-reported focus, and do nothing without one or on a pinned screen.

workArea and cellRect(id) are in this screen's logical coordinates, origin at the screen's top-left, so a full-screen surface on the screen can place an item on a cell directly (the OSD and toast bands, A3 §3–§4).

currentDesktop and switchDesktop(index) are both 0-based, matching the row index of Workspaces.model.

pinnedDesktop is -1 for the live screen (forScreen) and the 0-based desktop for a screen vended by forScreenDesktop: a view of that desktop's placement whether or not it is current (A3 §7, the dashboard's grid). A pinned screen reads its mode and snapping layout per desktop (getModeForScreenDesktop, getLayoutForScreenDesktop) and its occupancy from WindowTracking.getWindowStatesForDesktop; it never follows the engine's focus or a tile batch, both of which are the current desktop's. See placementmap_desktop.cpp.

Member Enumeration Documentation

◆ Mode

Enumerator
None 
Snapping 
Tiling 
Scrolling 

Constructor & Destructor Documentation

◆ PlacementMapScreen() [1/2]

PhosphorShell::PlacementMapScreen::PlacementMapScreen ( const QString & screenName,
PlacementMap * parent )

◆ PlacementMapScreen() [2/2]

PhosphorShell::PlacementMapScreen::PlacementMapScreen ( const QString & screenName,
int desktopIndex,
PlacementMap * parent )

A screen pinned to the 0-based desktopIndex (placementmap_desktop.cpp).

◆ ~PlacementMapScreen()

PhosphorShell::PlacementMapScreen::~PlacementMapScreen ( )
override

Member Function Documentation

◆ activate()

void PhosphorShell::PlacementMapScreen::activate ( const QString & id)

Click on a cell.

Snapping: activate the zone's topmost window (WindowTracking.activateWindow), or snap the focused window into an empty zone. Tiling: activate that window. Scrolling: Scrolling.focusColumnAt, stepping one column at a time toward the cell on a daemon without it.

◆ activateNavigationWindow()

void PhosphorShell::PlacementMapScreen::activateNavigationWindow ( const QString & windowId)

Activate a window from the complete navigation model.

◆ applyMenuChoice()

void PhosphorShell::PlacementMapScreen::applyMenuChoice ( const QString & kind,
const QString & id )

Apply one menuModel entry: assign the layout / algorithm / template to this screen and desktop, or run the verb.

◆ aspect()

qreal PhosphorShell::PlacementMapScreen::aspect ( ) const
nodiscard

◆ aspectChanged

void PhosphorShell::PlacementMapScreen::aspectChanged ( )
signal

◆ cellRect()

QRect PhosphorShell::PlacementMapScreen::cellRect ( const QString & id) const

The cell's rect in this screen's logical coordinates, origin at its top-left (work-area fractions scaled onto workArea), or a null rect for an unknown id.

◆ cells()

QVariantList PhosphorShell::PlacementMapScreen::cells ( ) const
nodiscard

◆ cellsChanged

void PhosphorShell::PlacementMapScreen::cellsChanged ( )
signal

◆ changed

void PhosphorShell::PlacementMapScreen::changed ( )
signal

Coalesced: once per event-loop turn after any of the above.

◆ currentDesktop()

int PhosphorShell::PlacementMapScreen::currentDesktop ( ) const
nodiscard

◆ currentDesktopChanged

void PhosphorShell::PlacementMapScreen::currentDesktopChanged ( )
signal

◆ desktopCount()

int PhosphorShell::PlacementMapScreen::desktopCount ( ) const
nodiscard

◆ desktopCountChanged

void PhosphorShell::PlacementMapScreen::desktopCountChanged ( )
signal

◆ desktopsChanged()

void PhosphorShell::PlacementMapScreen::desktopsChanged ( )

◆ focusedCellId()

QString PhosphorShell::PlacementMapScreen::focusedCellId ( ) const

The id of the cell holding the focused window, or empty.

◆ focusedWindowChanged()

void PhosphorShell::PlacementMapScreen::focusedWindowChanged ( const QString & windowId)

Tiling.focusedWindowChanged for this screen: the engine's own focus, which supersedes the singleton's focus-request proxy.

◆ isPinned()

bool PhosphorShell::PlacementMapScreen::isPinned ( ) const
nodiscard

◆ isUrgent()

bool PhosphorShell::PlacementMapScreen::isUrgent ( ) const
nodiscard

◆ layoutsAvailable()

bool PhosphorShell::PlacementMapScreen::layoutsAvailable ( ) const
nodiscard

◆ layoutsAvailableChanged

void PhosphorShell::PlacementMapScreen::layoutsAvailableChanged ( )
signal

◆ lens()

QVariantMap PhosphorShell::PlacementMapScreen::lens ( ) const
nodiscard

◆ lensChanged

void PhosphorShell::PlacementMapScreen::lensChanged ( )
signal

◆ menuModel()

QVariantList PhosphorShell::PlacementMapScreen::menuModel ( ) const
nodiscard

◆ menuModelChanged

void PhosphorShell::PlacementMapScreen::menuModelChanged ( )
signal

◆ mode()

int PhosphorShell::PlacementMapScreen::mode ( ) const
nodiscard

◆ modeChanged

void PhosphorShell::PlacementMapScreen::modeChanged ( )
signal

◆ moveCell()

void PhosphorShell::PlacementMapScreen::moveCell ( const QString & fromId,
const QString & toId )

Drag of one cell onto another (A2 §1.5).

Snapping: Snap.swapWindowsById when the target is occupied, else Snap.moveWindowToZone. Tiling: Autotile.swapWindows. Scrolling: Scrolling.moveColumnTo, inert on a daemon without it.

◆ moveNavigationWindowToDesktop()

void PhosphorShell::PlacementMapScreen::moveNavigationWindowToDesktop ( const QString & windowId,
int index )

Move any window in the navigation model, including offscreen columns.

◆ moveToDesktop()

void PhosphorShell::PlacementMapScreen::moveToDesktop ( const QString & id,
int index )

Move the cell's window to the desktop at this 0-based row of Workspaces.model (WindowTracking.moveWindowToDesktop, 1-based on the wire).

Inert on a daemon without it.

◆ occupancyChanged()

void PhosphorShell::PlacementMapScreen::occupancyChanged ( )

Occupancy (snapping) or focus (any mode) changed upstream.

◆ overflowChanged

void PhosphorShell::PlacementMapScreen::overflowChanged ( )
signal

◆ overflowLeft()

int PhosphorShell::PlacementMapScreen::overflowLeft ( ) const
nodiscard

◆ overflowRight()

int PhosphorShell::PlacementMapScreen::overflowRight ( ) const
nodiscard

◆ pinnedDesktop()

int PhosphorShell::PlacementMapScreen::pinnedDesktop ( ) const
nodiscard

◆ placeNavigationWindowInZone()

void PhosphorShell::PlacementMapScreen::placeNavigationWindowInZone ( const QString & windowId,
const QString & zoneId )

◆ refreshGeometry()

void PhosphorShell::PlacementMapScreen::refreshGeometry ( )

Re-read the work area, the screen origin and the output's scale.

◆ refreshMenu()

void PhosphorShell::PlacementMapScreen::refreshMenu ( )

Re-fetch menuModel for the current mode.

Async; menuModelChanged fires when the list is in.

◆ refreshMode()

void PhosphorShell::PlacementMapScreen::refreshMode ( )

Re-read the mode for the current (screen, desktop, activity).

◆ registerDropProxy()

void PhosphorShell::PlacementMapScreen::registerDropProxy ( const QRect & miniatureScreenRect,
const QVariantList & cellScreenRects )

Register the miniature as a drop proxy for the compositor's own window drag (WindowDrag.registerDropProxy).

miniatureScreenRect is the miniature's rect and cellScreenRects one {id, x, y, w, h} map per cell, both in this screen's logical coordinates with its top-left as origin, as the daemon reads them. Snapping only; a no-op otherwise and on a daemon without it. Change-gated: re-sent only when the payload differs.

◆ reseed()

void PhosphorShell::PlacementMapScreen::reseed ( )

Forget everything and re-resolve from the daemon.

Called by the singleton when the service (re)appears.

◆ screenId()

QString PhosphorShell::PlacementMapScreen::screenId ( ) const
nodiscard

◆ screenIdChanged

void PhosphorShell::PlacementMapScreen::screenIdChanged ( )
signal

◆ screenName()

QString PhosphorShell::PlacementMapScreen::screenName ( ) const
nodiscard

◆ scrollView()

void PhosphorShell::PlacementMapScreen::scrollView ( int delta)

Wheel over the map.

Scrolling pans the strip; snapping and tiling move focus one cell in reading order.

◆ scrollViewByPx()

void PhosphorShell::PlacementMapScreen::scrollViewByPx ( int px)

Drag of the lens: pan the strip's view by px in strip space (Scrolling.scrollViewByPx).

Scrolling only.

◆ serviceLost()

void PhosphorShell::PlacementMapScreen::serviceLost ( )

The daemon left the bus: mode -1, no cells.

◆ setPlacementMode()

void PhosphorShell::PlacementMapScreen::setPlacementMode ( int mode)

◆ stripChanged()

void PhosphorShell::PlacementMapScreen::stripChanged ( )

Scrolling.stripChanged / stripContextChanged for this screen.

◆ stripExtentChanged

void PhosphorShell::PlacementMapScreen::stripExtentChanged ( )
signal

◆ stripExtentPx()

int PhosphorShell::PlacementMapScreen::stripExtentPx ( ) const
nodiscard

◆ switchDesktop()

void PhosphorShell::PlacementMapScreen::switchDesktop ( int index)

Switch to the desktop at this 0-based row of Workspaces.model.

◆ tileBatchReceived()

void PhosphorShell::PlacementMapScreen::tileBatchReceived ( const QList< PlacementMapParser::TileRect > & tiles)

A windowsTileRequested batch arrived; ignored unless it names us.

◆ tilingChanged()

void PhosphorShell::PlacementMapScreen::tilingChanged ( )

Tiling.tilingChanged for this screen.

◆ toggleFloat()

void PhosphorShell::PlacementMapScreen::toggleFloat ( const QString & id)

Middle-click: float the cell's window.

Snapping: Snap.toggleFloatForWindow. Tiling and scrolling: WindowTracking.setWindowFloatingForScreen, falling back to the Snap verb on a daemon without it.

◆ unregisterDropProxy()

void PhosphorShell::PlacementMapScreen::unregisterDropProxy ( )

Withdraw the drop proxy, if one is registered.

◆ urgentChanged

void PhosphorShell::PlacementMapScreen::urgentChanged ( )
signal

◆ windows()

QVariantList PhosphorShell::PlacementMapScreen::windows ( ) const
nodiscard

◆ windowsChanged

void PhosphorShell::PlacementMapScreen::windowsChanged ( )
signal

◆ windowStatesChanged()

void PhosphorShell::PlacementMapScreen::windowStatesChanged ( )

WindowTracking.windowStateChanged landed in the singleton's table (or the table was re-seeded).

The live screen rebuilds from it; a pinned screen re-reads its desktop's states instead.

◆ workArea()

QRect PhosphorShell::PlacementMapScreen::workArea ( ) const
nodiscard

◆ workAreaChanged

void PhosphorShell::PlacementMapScreen::workAreaChanged ( )
signal

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