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:
@@ -1,5 +1,6 @@
|
||||
package com.ts3client.ui;
|
||||
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import com.github.weisj.jsvg.SVGDocument;
|
||||
import com.github.weisj.jsvg.parser.LoaderContext;
|
||||
import com.github.weisj.jsvg.parser.SVGLoader;
|
||||
@@ -33,6 +34,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
*
|
||||
* <p>Rendering is cached per key and size: vector art is rasterised at the size it
|
||||
* is asked for, bitmaps are scaled from the closest resolution the pack ships.
|
||||
* {@link #SIZE} and {@link #TOOLBAR_SIZE} are unscaled; sizes passed in are pixels.
|
||||
*/
|
||||
public final class IconTheme {
|
||||
|
||||
@@ -86,12 +88,12 @@ public final class IconTheme {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/** @return the icon for a TeamSpeak icon key at 16×16, or {@code null} if no pack has it */
|
||||
/** @return the icon for a TeamSpeak icon key at tree-row size, or {@code null} if no pack has it */
|
||||
public static ImageIcon icon(String key) {
|
||||
return icon(key, SIZE);
|
||||
return icon(key, UIScale.scale(SIZE));
|
||||
}
|
||||
|
||||
/** @return the icon for a TeamSpeak icon key, or {@code null} if no pack has it */
|
||||
/** @return the icon for a TeamSpeak icon key at {@code size} pixels, or {@code null} if no pack has it */
|
||||
public static ImageIcon icon(String key, int size) {
|
||||
return INSTANCE.lookup(key, size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user