Skip to content

Commit

Permalink
OnScreenKeyboard: improved performance with altered border for focuse…
Browse files Browse the repository at this point in the history
…d button

The border for the focused button is now a compound border, with the default
button border on the outside and the red line border on the inside.

Consequently calling OnScreenKeyboard.repaint() is no longer required, as the
background corners no longer get littered with red border artefacts.
  • Loading branch information
bwRavencl committed Jul 2, 2024
1 parent 8a08196 commit 0c3ae5c
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,6 @@ private void readObject(final ObjectInputStream ignoredStream) throws NotSeriali

private void setFocus(final boolean focus) {
setBorder(focus ? focusedButtonBorder : defaultButtonBorder);
if (!focus) {
OnScreenKeyboard.this.repaint();
}

Toolkit.getDefaultToolkit().sync();
}

Expand All @@ -511,8 +507,9 @@ private void updateTheme() {
defaultForeground = UIManager.getColor("Button.foreground");

defaultButtonBorder = UIManager.getBorder("Button.border");
focusedButtonBorder = BorderFactory.createLineBorder(Color.RED,
Math.round(FOCUSED_BUTTON_BORDER_THICKNESS * main.getOverlayScaling()));
focusedButtonBorder = BorderFactory.createCompoundBorder(defaultButtonBorder,
BorderFactory.createLineBorder(Color.RED,
Math.round(FOCUSED_BUTTON_BORDER_THICKNESS * main.getOverlayScaling())));
}

@Override
Expand Down

0 comments on commit 0c3ae5c

Please sign in to comment.