srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/wayland/src/snap_flyout.rs
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-08-13 16:51:00 +0200
committersrdusr <[email protected]>2026-08-13 16:51:00 +0200
commitf7426a86f2ccc40a18bc6b21d92fc3f073490de1 (patch)
tree4aee9c493b0bbd6270eaba756b74ce8b9cdf9fc6 /crates/wayland/src/snap_flyout.rs
parent38d899d19b5e5204062ecab4bb4105d51afddb6b (diff)
downloadsrdwm-f7426a86f2ccc40a18bc6b21d92fc3f073490de1.tar.gz
srdwm-f7426a86f2ccc40a18bc6b21d92fc3f073490de1.zip
Elide a long window title instead of cutting it mid-glyph
A title that did not fit was hard-cut at whatever character crossed the button reservation. Nothing marked the cut, so a truncated name read as the whole name - "annual-report-final-v7-reviewed-2026-with-appendix.ods - LibreO" looks like a filename, not like a filename with its tail missing. Titles now end in an ellipsis when they are shortened, which is what Windows, GNOME and KDE all do, and it keeps the informative half: an application or document title almost always begins distinctively and ends in boilerplate. Whole characters are dropped until the ellipsis fits beside what remains, so the result never overruns the buttons. A titlebar with no room even for the ellipsis draws nothing, rather than a lone "..." that says less than an empty titlebar does. The mark itself is "…" where the system font has that glyph and "..." where it does not. A missing glyph rasterizes to nothing at all, which would have quietly reintroduced the invisible-truncation problem on any font without it. Also bounded the work: a client may set a title of any length - a browser tab carrying a whole data URL - and every character cost a rasterization before the layout could decide it did not fit. Measurement stops at 256 characters, well past anything legible in a titlebar, and a title that long is elided many times over regardless. Four tests: an over-long title fits its span and ends in the ellipsis mark; a title that fits is left exactly alone; a titlebar too narrow for the ellipsis draws nothing; a 20,000-character title never lays out more than the cap. Checked on screen too, at 600px and at 220px.
Diffstat (limited to 'crates/wayland/src/snap_flyout.rs')
0 files changed, 0 insertions, 0 deletions