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.ScaledEmptyBorder;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import com.ts3client.net.ChannelSettings;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
@@ -49,8 +51,8 @@ final class ChannelAudioPanel extends JPanel implements ChannelDialog.Tab {
|
||||
private final JPanel customSettings = new JPanel(new GridBagLayout());
|
||||
|
||||
ChannelAudioPanel() {
|
||||
super(new BorderLayout(8, 8));
|
||||
setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
||||
super(new BorderLayout(UIScale.scale(8), UIScale.scale(8)));
|
||||
setBorder(new ScaledEmptyBorder(8, 8, 8, 8));
|
||||
|
||||
ButtonGroup presets = new ButtonGroup();
|
||||
presets.add(voiceMobile);
|
||||
@@ -126,7 +128,7 @@ final class ChannelAudioPanel extends JPanel implements ChannelDialog.Tab {
|
||||
private JPanel customBox() {
|
||||
customSettings.setBorder(BorderFactory.createTitledBorder("Custom Settings"));
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.insets = new Insets(4, 4, 4, 4);
|
||||
c.insets = UIScale.scale(new Insets(4, 4, 4, 4));
|
||||
c.anchor = GridBagConstraints.WEST;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
|
||||
@@ -158,7 +160,7 @@ final class ChannelAudioPanel extends JPanel implements ChannelDialog.Tab {
|
||||
}
|
||||
|
||||
private JPanel bandwidthRow() {
|
||||
JPanel row = new JPanel(new BorderLayout(6, 0));
|
||||
JPanel row = new JPanel(new BorderLayout(UIScale.scale(6), 0));
|
||||
row.add(new JLabel("Bandwidth usage:"), BorderLayout.WEST);
|
||||
row.add(bandwidth, BorderLayout.CENTER);
|
||||
return row;
|
||||
|
||||
Reference in New Issue
Block a user