Scale the interface fractionally on Linux

Java2D on X11 (and so under XWayland) truncates its scale to a whole
number, drawing 150 % at 100 %. On Linux, pin Java2D to 1 and hand the
full factor to FlatLaf, taken from XSETTINGS Xft/DPI, KWin's Xwayland
scale or GDK_SCALE, or chosen in Options → Design.

The client's own sizes now go through UIScale: borders, gaps, dialog and
row sizes, icons (rendered at the scaled size, so they stay crisp),
custom-painted components and font sizes in the HTML views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 22:33:27 +00:00
parent 1fddae3f0b
commit 9d996f48a2
57 changed files with 643 additions and 311 deletions

View File

@@ -169,6 +169,18 @@ frontend supplies its own UI and audio backend while reusing `core` unchanged.
- **Pick one in Options → Design**, which also shows a viewer of everything the pack
contains; switching redraws the window right away.
### Display scaling (Linux)
- Java2D on X11 (and so under XWayland) only scales by whole numbers, so 125 % or
150 % comes out at 100 %. On Linux the client pins Java2D to 1 and hands the full
factor to FlatLaf instead, scaling its own sizes and icons to match.
- The factor follows the desktop: XSETTINGS `Xft/DPI` (GNOME, Plasma), else KWin's
XWayland scale, else `GDK_SCALE`. For crisp text on Wayland, let X11 apps scale
themselves (Plasma: *Display Configuration → Legacy Applications → Apply scaling
themselves*; GNOME: the `xwayland-native-scaling` mutter feature), otherwise the
compositor upscales the window.
- **Options → Design → Interface scale** overrides it (after a restart);
`-Dflatlaf.uiScale=` or `-Dsun.java2d.uiScale=` on the command line bypasses all this.
## Requirements
- Java 26+ (developed/tested on Temurin 26)
- The native Opus library on the system:
@@ -269,6 +281,7 @@ swing/ com.ts3client
├── HotkeyActions carries a fired hotkey out on the client
├── NotificationsPanel sound pack + per-action sound/important configuration
├── IconPackPanel icon pack chooser + icon viewer (Options → Design)
├── DisplayScale interface scale on Linux (fractional, via FlatLaf)
├── ConnectDialog connect form
├── BookmarksDialog manage saved servers
├── IdentitiesDialog manage identities (new/import/export/improve)