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,8 +1,9 @@
|
||||
package com.ts3client.ui;
|
||||
|
||||
import com.formdev.flatlaf.util.ScaledEmptyBorder;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import com.ts3client.config.Settings;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
@@ -32,11 +33,11 @@ final class ContactsPanel extends JPanel {
|
||||
ContactsPanel(Settings settings) {
|
||||
super(new BorderLayout());
|
||||
this.settings = settings;
|
||||
setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
|
||||
setBorder(new ScaledEmptyBorder(12, 12, 12, 12));
|
||||
|
||||
JPanel p = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.insets = new Insets(2, 2, 2, 2);
|
||||
c.insets = UIScale.scale(new Insets(2, 2, 2, 2));
|
||||
c.anchor = GridBagConstraints.WEST;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.gridx = 0;
|
||||
@@ -48,10 +49,10 @@ final class ContactsPanel extends JPanel {
|
||||
p.add(colorContacts, c);
|
||||
|
||||
c.gridy = 1;
|
||||
c.insets = new Insets(12, 2, 2, 2);
|
||||
c.insets = UIScale.scale(new Insets(12, 2, 2, 2));
|
||||
p.add(new JLabel("Whispers: who is allowed to whisper to you"), c);
|
||||
c.gridy = 2;
|
||||
c.insets = new Insets(2, 2, 2, 2);
|
||||
c.insets = UIScale.scale(new Insets(2, 2, 2, 2));
|
||||
whisperPolicy.setSelectedItem(settings.whisperPolicy);
|
||||
whisperPolicy.setRenderer(new DefaultListCellRenderer() {
|
||||
@Override
|
||||
@@ -68,7 +69,7 @@ final class ContactsPanel extends JPanel {
|
||||
p.add(whisperPolicy, c);
|
||||
|
||||
c.gridy = 3;
|
||||
c.insets = new Insets(12, 2, 2, 2);
|
||||
c.insets = UIScale.scale(new Insets(12, 2, 2, 2));
|
||||
c.fill = GridBagConstraints.NONE;
|
||||
JButton defaults = new JButton("Contact defaults…");
|
||||
defaults.setToolTipText("Configure default settings when adding a client to the Contact Manager");
|
||||
|
||||
Reference in New Issue
Block a user