Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorScrollEngine::TabIndicatorParams Struct Reference

The tab indicator's GEOMETRY inputs — the subset of the Scrolling.TabIndicator family that changes resolved rects, so it has to live in the layout params rather than staying with the paint half. More...

#include <PhosphorScrollEngine/ScrollTypes.h>

Public Member Functions

int reservedThickness (int tileCount) const
 Pixels this indicator takes out of the column along the indicator's THICKNESS axis (the column's width for a left/right indicator, its height for top/bottom) when placeWithinColumn is set, and 0 otherwise.
bool resolvesFor (int tileCount) const
 Whether a tabbed column with tileCount tiles draws an indicator.
QRect contentRectFor (const QRect &columnRect, int tileCount) const
 The rect the column's TILES get, i.e.
QRect indicatorRectFor (const QRect &columnRect, int tileCount) const
 Where the indicator is drawn for a column occupying columnRect, in the same coordinates.

Public Attributes

bool enabled = true
 Off, no indicator rect is resolved and placeWithinColumn reserves nothing — a tabbed column lays out exactly as it did before the indicator existed.
bool hideWhenSingleTab = false
 Skip the indicator for a tabbed column holding a single tile.
bool placeWithinColumn = false
 Reserve the indicator's thickness plus its gap out of the column, shrinking the tile rects, instead of drawing over whatever sits beside the column.
int gap = 5
 Gap between the indicator and the window.
int width = 4
 Indicator thickness (its short axis) in pixels, EXACT for every style.
qreal lengthProportion = 0.5
 Indicator length along its long axis, as a proportion of the column extent it runs beside.
TabIndicatorPosition position = TabIndicatorPosition::Left

Detailed Description

The tab indicator's GEOMETRY inputs — the subset of the Scrolling.TabIndicator family that changes resolved rects, so it has to live in the layout params rather than staying with the paint half.

The paint-only keys (style, gaps between tabs, corner radius, the three colours and the five label-font keys) never reach this library: they go to the KWin effect, which draws the indicator itself. See IScrollSettings.h for the same split stated from the settings side.

Member Function Documentation

◆ contentRectFor()

QRect PhosphorScrollEngine::TabIndicatorParams::contentRectFor ( const QRect & columnRect,
int tileCount ) const
inline

The rect the column's TILES get, i.e.

columnRect minus whatever the indicator reserved. Identical to columnRect unless placeWithinColumn is set and an indicator actually resolves.

◆ indicatorRectFor()

QRect PhosphorScrollEngine::TabIndicatorParams::indicatorRectFor ( const QRect & columnRect,
int tileCount ) const
inline

Where the indicator is drawn for a column occupying columnRect, in the same coordinates.

Null when no indicator resolves (see resolvesFor). Outside columnRect unless placeWithinColumn.

The indicator is CENTERED on its long axis, so shortening it with lengthProportion trims both ends evenly rather than anchoring it to one corner. That is niri's behaviour and the only choice that keeps a short indicator visually attached to the column it belongs to.

◆ reservedThickness()

int PhosphorScrollEngine::TabIndicatorParams::reservedThickness ( int tileCount) const
inline

Pixels this indicator takes out of the column along the indicator's THICKNESS axis (the column's width for a left/right indicator, its height for top/bottom) when placeWithinColumn is set, and 0 otherwise.

Floored at 0 so a negative gap large enough to cancel the thickness cannot GROW the column. tileCount lets the single-tab skip suppress the reservation, keeping the reservation and the drawn rect in agreement.

Which strip ROLE that thickness comes out of depends on the axis: a left/right indicator eats the column's MAIN extent on a horizontal strip and its CROSS extent on a vertical one, and the top/bottom pair inverts the same way. The screen-edge vocabulary above is deliberate and stays; the role is resolved by the caller that knows the axis (see the min-extent floor in scrollstrip_relayout.cpp, which states the same inversion).

◆ resolvesFor()

bool PhosphorScrollEngine::TabIndicatorParams::resolvesFor ( int tileCount) const
inline

Whether a tabbed column with tileCount tiles draws an indicator.

Member Data Documentation

◆ enabled

bool PhosphorScrollEngine::TabIndicatorParams::enabled = true

Off, no indicator rect is resolved and placeWithinColumn reserves nothing — a tabbed column lays out exactly as it did before the indicator existed.

◆ gap

int PhosphorScrollEngine::TabIndicatorParams::gap = 5

Gap between the indicator and the window.

NEGATIVE IS MEANINGFUL and matches niri: it slides the indicator onto the window. Under placeWithinColumn a negative gap correspondingly reserves less than the thickness, and the reservation floors at zero.

This seed is niri's own literal and is NOT the shipped default. The shipped one is ConfigDefaults::scrollingTabIndicatorGap(), which derives it from the inner gap and the bar thickness and currently comes out smaller. That accessor lives in the app tree, which this library cannot include, so the two cannot be single-sourced; the engine overwrites this field from settings on every refresh, which is what makes the divergence invisible outside direct constructions and test fixtures.

◆ hideWhenSingleTab

bool PhosphorScrollEngine::TabIndicatorParams::hideWhenSingleTab = false

Skip the indicator for a tabbed column holding a single tile.

Affects the resolved rect (and therefore the reservation) as well as the payload, so a single-tab column under this flag lays out full-bleed.

◆ lengthProportion

qreal PhosphorScrollEngine::TabIndicatorParams::lengthProportion = 0.5

Indicator length along its long axis, as a proportion of the column extent it runs beside.

◆ placeWithinColumn

bool PhosphorScrollEngine::TabIndicatorParams::placeWithinColumn = false

Reserve the indicator's thickness plus its gap out of the column, shrinking the tile rects, instead of drawing over whatever sits beside the column.

This is the only field here that moves windows.

◆ position

TabIndicatorPosition PhosphorScrollEngine::TabIndicatorParams::position = TabIndicatorPosition::Left

◆ width

int PhosphorScrollEngine::TabIndicatorParams::width = 4

Indicator thickness (its short axis) in pixels, EXACT for every style.

Load-bearing for reservedThickness: this library cannot measure text, so a style that sized itself to its own font would draw outside the band reserved for it and over the window. Both sides agree on this one number instead, and a style whose content does not fit clips.


The documentation for this struct was generated from the following file:
  • phosphor-scroll-engine/include/PhosphorScrollEngine/ScrollTypes.h