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.text.BBCode;
|
||||
import com.ts3client.text.TsLink;
|
||||
|
||||
@@ -96,8 +98,8 @@ public final class ChatPanel extends JPanel {
|
||||
dragReorder.attach(tabs);
|
||||
add(tabs, BorderLayout.CENTER);
|
||||
|
||||
JPanel bottom = new JPanel(new BorderLayout(4, 0));
|
||||
bottom.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
|
||||
JPanel bottom = new JPanel(new BorderLayout(UIScale.scale(4), 0));
|
||||
bottom.setBorder(new ScaledEmptyBorder(4, 0, 0, 0));
|
||||
bottom.add(input, BorderLayout.CENTER);
|
||||
add(bottom, BorderLayout.SOUTH);
|
||||
|
||||
@@ -345,7 +347,8 @@ public final class ChatPanel extends JPanel {
|
||||
final int clientId;
|
||||
private String clientUniqueId;
|
||||
private String title;
|
||||
final JEditorPane log = HtmlStyles.pane("font-family:sans-serif; font-size:11px; margin:4px 6px;");
|
||||
final JEditorPane log = HtmlStyles.pane("font-family:sans-serif; font-size:11px; margin:"
|
||||
+ HtmlStyles.px(4) + " " + HtmlStyles.px(6) + ";");
|
||||
final JScrollPane scroll;
|
||||
/** Set for a static-content tab (e.g. a moved-out description); null for a conversation. */
|
||||
final String noteKey;
|
||||
@@ -408,17 +411,17 @@ public final class ChatPanel extends JPanel {
|
||||
Component header(boolean closable) {
|
||||
// Only the height is pinned: a fixed width would freeze the tab at the width of
|
||||
// whatever name it was built with, clipping longer ones (and the bold unread font).
|
||||
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)) {
|
||||
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT, UIScale.scale(2), 0)) {
|
||||
@Override
|
||||
public Dimension getPreferredSize() {
|
||||
Dimension d = super.getPreferredSize();
|
||||
return new Dimension(d.width, Math.max(d.height, HEADER_HEIGHT));
|
||||
return new Dimension(d.width, Math.max(d.height, UIScale.scale(HEADER_HEIGHT)));
|
||||
}
|
||||
};
|
||||
p.setOpaque(false);
|
||||
titleLabel = new JLabel(title, icon, JLabel.LEADING);
|
||||
titleLabel.setFont(Theme.uiFont());
|
||||
titleLabel.setIconTextGap(3);
|
||||
titleLabel.setIconTextGap(UIScale.scale(3));
|
||||
p.add(titleLabel);
|
||||
dragReorder.attach(p);
|
||||
dragReorder.attach(titleLabel);
|
||||
|
||||
Reference in New Issue
Block a user