Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
ScrollEngineTypes.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
6// The ScrollEngine's own public VALUE types: what a per-window open rule can
7// say about an arriving window, and what one visible tile of a strip is.
8// Split out of ScrollEngine.h at its file-size ceiling, the same hoist
9// ScrollStashTypes.h made for the stash types. ScrollEngine.h includes this
10// and aliases both tile types back into the class, so ScrollEngine::VisibleTile
11// keeps naming ScrollVisibleTile for every existing consumer.
12//
13// ScrollTypes.h stays the STRIP MODEL's vocabulary (widths, heights, resolved
14// columns). The types here describe the engine's API surface around that
15// model, which is why they live apart from it.
16
17// The one crossing into the strip model's vocabulary: a visible tile reports
18// the tab indicator its column draws, and TabIndicatorPosition is that
19// model's enum. Not re-declared here — a second spelling of the four edges
20// is exactly the kind of parallel vocabulary the split above exists to avoid.
23
24#include <QRect>
25#include <QRectF>
26#include <QString>
27#include <QVector>
28
29#include <optional>
30
31namespace PhosphorScrollEngine {
32
38{
39 std::optional<qreal> widthFraction;
42 std::optional<qreal> heightFraction;
43 std::optional<bool> tabbed;
45 std::optional<bool> consume;
57 std::optional<bool> maximized;
62 std::optional<bool> focused;
68 std::optional<QString> tabGroup;
69};
70
137
146
156{
157 QString windowId;
168 QRectF relRect;
169 bool minimized = false;
172 bool hidden = false;
174 bool activeTab = false;
175};
176
184{
185 bool tabbed = false;
191 qreal widthFraction = 0.0;
193 QVector<ScrollStripSnapshotTile> tiles;
194};
195
212{
213 QVector<ScrollStripSnapshotColumn> columns;
223 bool valid = false;
224};
225
231{
232 QString windowId;
238 int crossPx = 0;
239 bool minimized = false;
240};
241
244{
246 int index = -1;
249 int stripPosPx = 0;
252 int extentPx = 0;
256 int activeTile = 0;
260 bool maximized = false;
261 QVector<ScrollStripModelTile> tiles;
262};
263
272{
279 int viewportPx = 0;
283 int activeColumn = -1;
284 QVector<ScrollStripModelColumn> columns;
285};
286
287} // namespace PhosphorScrollEngine
Coordinate mapping for one strip orientation: a pure value type, trivially copyable,...
Definition StripAxis.h:35
static constexpr StripAxis horizontal()
Definition StripAxis.h:43
Definition ScrollEngine.h:46
ColumnDisplay
How a column presents its tiles (niri's column display).
Definition ScrollTypes.h:246
@ Normal
Tiles split the column's CROSS extent between them; all are visible.
Definition ScrollTypes.h:248
TabIndicatorPosition
Which side of the column the tab indicator runs along (niri's TabIndicatorPosition,...
Definition ScrollTypes.h:287
@ Left
Definition ScrollTypes.h:288
Per-window open-behaviour overrides resolved from window rules (openColumnWidth / openTabbed / openCo...
Definition ScrollEngineTypes.h:38
std::optional< qreal > widthFraction
Definition ScrollEngineTypes.h:39
std::optional< bool > maximized
True: the new column opens at the full work-area width (openMaximized rule).
Definition ScrollEngineTypes.h:57
std::optional< QString > tabGroup
Named tab group (openTabGroup rule), trimmed and non-empty when engaged.
Definition ScrollEngineTypes.h:68
std::optional< qreal > heightFraction
Work-area height fraction (openWindowHeight rule), committed as a Fixed pixel intent against the live...
Definition ScrollEngineTypes.h:42
std::optional< bool > focused
Per-window override of IScrollSettings::scrollingFocusNewWindows (openFocused rule).
Definition ScrollEngineTypes.h:62
std::optional< bool > tabbed
Definition ScrollEngineTypes.h:43
std::optional< bool > consume
True: join the focused column instead of opening a new one.
Definition ScrollEngineTypes.h:45
One column of a strip model, in strip order.
Definition ScrollEngineTypes.h:244
int index
Strip index, which is also the index focusColumnAtIndex takes.
Definition ScrollEngineTypes.h:246
int activeTile
Index into tiles of the column's active tile (the shown tab of a tabbed column).
Definition ScrollEngineTypes.h:256
QVector< ScrollStripModelTile > tiles
Definition ScrollEngineTypes.h:261
bool maximized
Column::maximizedToEdges, the declared state the compositor mirrors onto the maximize bit.
Definition ScrollEngineTypes.h:260
ColumnDisplay display
Definition ScrollEngineTypes.h:253
int stripPosPx
The column's LEADING edge in strip coordinates (the first column's leading edge is 0),...
Definition ScrollEngineTypes.h:249
int extentPx
The column's resolved extent ALONG the strip, in pixels.
Definition ScrollEngineTypes.h:252
One tile of a strip MODEL (see ScrollStripModel).
Definition ScrollEngineTypes.h:231
bool minimized
Definition ScrollEngineTypes.h:239
QString windowId
Definition ScrollEngineTypes.h:232
int crossPx
The tile's resolved extent ACROSS the strip, in pixels: its height on a horizontal strip,...
Definition ScrollEngineTypes.h:238
The whole strip of one screen as a renderer of a strip MAP needs it: every column with its strip posi...
Definition ScrollEngineTypes.h:272
int viewOffsetPx
The viewport's leading edge in strip coordinates.
Definition ScrollEngineTypes.h:277
StripAxis axis
Definition ScrollEngineTypes.h:273
int activeColumn
Strip index of the active column, -1 on an empty strip.
Definition ScrollEngineTypes.h:283
int stripExtentPx
Total strip extent: every non-minimized column plus the gaps between.
Definition ScrollEngineTypes.h:281
QVector< ScrollStripModelColumn > columns
Definition ScrollEngineTypes.h:284
int viewportPx
The viewport's extent along the strip (the work area's main extent).
Definition ScrollEngineTypes.h:279
One column of a strip snapshot, in strip order.
Definition ScrollEngineTypes.h:184
qreal widthFraction
Resolved column extent ALONG THE STRIP as a fraction of the work area's extent on that same axis (eng...
Definition ScrollEngineTypes.h:191
bool tabbed
Definition ScrollEngineTypes.h:185
QVector< ScrollStripSnapshotTile > tiles
MODEL tile order, minimized tiles included.
Definition ScrollEngineTypes.h:193
One tile of a strip snapshot (see ScrollEngine::stripSnapshot).
Definition ScrollEngineTypes.h:156
bool hidden
Non-active tab of a tabbed column.
Definition ScrollEngineTypes.h:172
QString windowId
Definition ScrollEngineTypes.h:157
QRectF relRect
Rect relative to the owning column's resolved bounds, 0..1 on x.
Definition ScrollEngineTypes.h:168
bool minimized
Definition ScrollEngineTypes.h:169
bool activeTab
The column's active tile (for a tabbed column: the visible tab).
Definition ScrollEngineTypes.h:174
A column-aware strip snapshot for drag-popup renderers.
Definition ScrollEngineTypes.h:212
int activeColumnIndex
Snapshot position of the strip's active column.
Definition ScrollEngineTypes.h:218
QVector< ScrollStripSnapshotColumn > columns
Definition ScrollEngineTypes.h:213
bool valid
False when the screen has no strip state or no valid work area — distinct from a valid,...
Definition ScrollEngineTypes.h:223
A tile paired with its screen-normalized rect, from ONE strip walk (see ScrollEngine::visibleTilesWit...
Definition ScrollEngineTypes.h:141
ScrollVisibleTile tile
Definition ScrollEngineTypes.h:142
QRectF relativeRect
Same basis and fallback as ScrollEngine::visibleTileRectsRelative.
Definition ScrollEngineTypes.h:144
One visible tile of a strip: the unit of the scroll "zone number" space.
Definition ScrollEngineTypes.h:89
int columnIndex
Strip index of the owning column.
Definition ScrollEngineTypes.h:96
TabIndicatorPosition tabIndicatorPosition
Which edge of the column the indicator runs along.
Definition ScrollEngineTypes.h:123
int activeTabIndex
Which tab of tabCount this tile is, 0-based, and -1 when the column draws no indicator.
Definition ScrollEngineTypes.h:119
int tabCount
How many tabs the owning column's indicator shows, and 0 when it draws no indicator at all.
Definition ScrollEngineTypes.h:115
qreal tabLengthProportion
How much of that edge the indicator covers, 0 to 1, centered on it (TabIndicatorParams::indicatorRect...
Definition ScrollEngineTypes.h:135
QRect rect
Absolute pixel rect, clipped to the work area.
Definition ScrollEngineTypes.h:103
int zoneNumber
The tile's 1-based zone number, stamped by the walk.
Definition ScrollEngineTypes.h:101
QString windowId
Definition ScrollEngineTypes.h:90