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,7 @@
|
||||
package com.ts3client.ui;
|
||||
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
@@ -22,7 +24,7 @@ final class AvatarView extends JComponent {
|
||||
|
||||
AvatarView(int boxSize) {
|
||||
this.boxSize = boxSize;
|
||||
setPreferredSize(new Dimension(boxSize, boxSize));
|
||||
setPreferredSize(UIScale.scale(new Dimension(boxSize, boxSize)));
|
||||
setMinimumSize(getPreferredSize());
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ final class AvatarView extends JComponent {
|
||||
imageHeight = image.getHeight(this);
|
||||
if (imageWidth < 0 || imageHeight < 0) return;
|
||||
}
|
||||
double scale = Math.min(1.0, Math.min((double) getWidth() / imageWidth, (double) getHeight() / imageHeight));
|
||||
double scale = Math.min(UIScale.getUserScaleFactor(), Math.min((double) getWidth() / imageWidth, (double) getHeight() / imageHeight));
|
||||
int w = Math.max(1, (int) Math.round(imageWidth * scale));
|
||||
int h = Math.max(1, (int) Math.round(imageHeight * scale));
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
|
||||
Reference in New Issue
Block a user