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

Per-screen overflow window tracking (pure tracking — no PhosphorTiles::TilingState mutation) More...

#include <phosphor-tile-engine/include/PhosphorTileEngine/OverflowManager.h>

Public Member Functions

void markOverflow (const QString &windowId, const QString &screenId)
 Mark a window as overflow on a specific screen.
 
void clearOverflow (const QString &windowId)
 Clear overflow status for a window (any screen)
 
bool isOverflow (const QString &windowId) const
 Check if a window is currently overflow-tracked.
 
QStringList applyOverflow (const QString &screenId, const QStringList &windows, int tileCount)
 Identify windows beyond tileCount that should be auto-floated.
 
QStringList recoverIfRoom (const QString &screenId, int tiledCount, int maxWindows, const std::function< bool(const QString &)> &isFloating, const std::function< bool(const QString &)> &containsWindow)
 Identify overflow windows that should be unfloated when room opens.
 
QSet< QString > takeForScreen (const QString &screenId)
 Take and remove all overflow entries for a screen.
 
void migrateWindow (const QString &windowId)
 Clear overflow status when a window migrates between screens.
 
void clearForRemovedScreens (const QSet< QString > &activeScreens)
 Clear overflow entries for windows on screens not in the active set.
 
bool isEmpty () const
 Check if there are any overflow windows tracked.
 

Detailed Description

Per-screen overflow window tracking (pure tracking — no PhosphorTiles::TilingState mutation)

Manages the bookkeeping for windows that are auto-floated when the tiled window count exceeds maxWindows. Uses per-screen storage (QHash<screenId, QSet<windowId>>) plus a reverse index (windowId -> screenId) for O(1) lookups.

Distinguished from user-floated windows so they can be auto-unfloated when room becomes available (e.g., window closed, maxWindows increased).

This class does NOT mutate PhosphorTiles::TilingState. It returns lists of window IDs that should be floated/unfloated and the caller performs the mutations and signal emissions.

Member Function Documentation

◆ applyOverflow()

QStringList PhosphorTileEngine::OverflowManager::applyOverflow ( const QString &  screenId,
const QStringList &  windows,
int  tileCount 
)

Identify windows beyond tileCount that should be auto-floated.

Marks the excess windows as overflow. Does NOT call state->setFloating(); the caller is responsible for mutating PhosphorTiles::TilingState and emitting signals.

Parameters
windowsInStateList of all tiled windows (from PhosphorTiles::TilingState)
isFloatingPredicate: returns true if a window is already floating
screenIdScreen where overflow is being applied
windowsOrdered window list from PhosphorTiles::TilingState::tiledWindows()
tileCountNumber of available tile zones
Returns
Window IDs that should be newly auto-floated (caller mutates state)

◆ clearForRemovedScreens()

void PhosphorTileEngine::OverflowManager::clearForRemovedScreens ( const QSet< QString > &  activeScreens)

Clear overflow entries for windows on screens not in the active set.

Used during screen deactivation to clean up orphaned overflow entries that weren't caught by takeForScreen().

Parameters
activeScreensSet of currently active autotile screen names

◆ clearOverflow()

void PhosphorTileEngine::OverflowManager::clearOverflow ( const QString &  windowId)

Clear overflow status for a window (any screen)

Uses the reverse index for O(1) lookup — no screen parameter needed.

◆ isEmpty()

bool PhosphorTileEngine::OverflowManager::isEmpty ( ) const

Check if there are any overflow windows tracked.

Returns
true if no overflow windows are tracked on any screen

◆ isOverflow()

bool PhosphorTileEngine::OverflowManager::isOverflow ( const QString &  windowId) const

Check if a window is currently overflow-tracked.

Returns
true if the window is in the overflow set on any screen

◆ markOverflow()

void PhosphorTileEngine::OverflowManager::markOverflow ( const QString &  windowId,
const QString &  screenId 
)

Mark a window as overflow on a specific screen.

If the window was previously tracked on a different screen, the old entry is cleaned up first to prevent ghost references. No-op if windowId or screenId is empty.

◆ migrateWindow()

void PhosphorTileEngine::OverflowManager::migrateWindow ( const QString &  windowId)

Clear overflow status when a window migrates between screens.

Uses the internal reverse index to find the correct per-screen set, ignoring the oldScreen hint (which may have diverged from the overflow manager's own tracking during cross-screen migration). The caller re-adds the window to the new screen's normal flow via onWindowAdded().

◆ recoverIfRoom()

QStringList PhosphorTileEngine::OverflowManager::recoverIfRoom ( const QString &  screenId,
int  tiledCount,
int  maxWindows,
const std::function< bool(const QString &)> &  isFloating,
const std::function< bool(const QString &)> &  containsWindow 
)

Identify overflow windows that should be unfloated when room opens.

Also purges stale entries (windows no longer floating or not in PhosphorTiles::TilingState) to prevent overflow tracking from growing unbounded.

Does NOT call state->setFloating(); the caller performs mutations.

Parameters
screenIdScreen to check for recovery
tiledCountCurrent number of tiled (non-floating) windows
maxWindowsMaximum windows allowed on the screen
isFloatingPredicate: returns true if window is currently floating
containsWindowPredicate: returns true if window exists in PhosphorTiles::TilingState
Returns
Window IDs that should be unfloated (caller mutates state and emits signals)

◆ takeForScreen()

QSet< QString > PhosphorTileEngine::OverflowManager::takeForScreen ( const QString &  screenId)

Take and remove all overflow entries for a screen.

Returns
Set of overflow window IDs that were on the screen

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