Problems with HiDpi Display under Gnome

Hey folks,

I use VASSAL under Manjaro/Gnome on a 4k display. After a month of not playing anything I updated VASSAL from 3.5.3 to 3.5.8 and did the necessary changes to vassal.sh to run it upscaled. Unfortunately it didn’t work as expected.

I tried to run it with

GDK_SACALE=2

and

-Dsun.java2d.uiScale=2

both commands scale the interface and text to 200% (to big) and the icons and maps in VASL are fine. Without them the interface/text is finde but all icons and maps are at 50%.

I also tried to use

GDK_DPI_SCALE=0.5

but it had no effect.

It is the same with VASSAL 3.5.3…

Any help?

Thanks

Michail

Would you post the complete contents of your shell script that’s not working?

This is the VASSAL.sh script without any changes:

#!/bin/sh

#
# Execute this file to launch VASSAL on Linux
#

JAVA=$(which java)

# Check that java exists
if [ ! -x "$JAVA" ]; then
  echo "Error: $JAVA cannot be run. Please ensure that Java is installed." 2>&1
  exit 1
fi

# Check the Java vesion; we require Java 11+.
VERSION=$("$JAVA" -version 2>&1 | head -1 | sed -e 's/.* version "//; s/".*//')

# Java 8 and earlier formats version x.y as 1.x.y
# Java 9 and later formats version x.y as x.y
MAJOR=$(echo "$VERSION" | sed -e 's/\..*//')
if [ "$MAJOR" = '1' ]; then
  MAJOR=$(echo "$VERSION" | sed -e 's/[0-9]\+\.//; s/[^0-9].*//')
fi

# Check that the major version we found is an integer
MAJOR=$(echo "$MAJOR" | sed -e 's/[^0-9]//g')
if [ -z "$MAJOR" ]; then
  echo "Error: VASSAL requires Java 11 or later. The Java you are using ($JAVA) has an unrecognizable version '$VERSION'." 2>&1
  exit 1
fi

# Check that the major version we found is >= 11
if [ "$MAJOR" -lt 11 ]; then
  echo "Error: VASSAL requires Java 11 or later. The Java you are using ($JAVA) is Java $MAJOR." 2>&1
  exit 1
fi

# Find absolute path where VASSAL is installed
INSTALL_DIR=$(cd "$(dirname "$0")"; pwd)

# Launch VASSSAL
"$JAVA" -Duser.dir="$INSTALL_DIR" -classpath "$INSTALL_DIR"/lib/Vengine.jar --add-exports java.desktop/sun.java2d.cmm=ALL-UNNAMED VASSAL.launch.ModuleManager "$@"

I tried putting

GDK_SACALE=2

in front of the 'launch VASSALline and

-Dsun.java2d.uiScale=2

as the first argument in the line. The latter changes just the scaling of VASSAL and not of VASL.

Thanks!

Ok. That’s what I suspected you were doing.

The reason what you did doesn’t work for the module is that the Module Manager launches the Player, which doesn’t inherit the flags the MM was started with.

What you need to do is put -Dsun.java2d.uiScale=2 in ~/.VASSAL/vassal.vmoptions. That’s where the MM gets additional options for starting the Player.

Thanks Uckelman, but that was not the main problem. The problem is that without

-Dsun.java2d.uiScale=2

the UI scales okay but the graphics are very small. With it the graphics are okay but the UI is at 200%. I added screenshots as attachments.

Sorry, I added the same picture twice. Here is the one with the argument.

To be clear, you’re saying that the icons on the buttons are the expected size, but the map renders too small?

In the second screenshot, what’s the zoom level set for the map?

Hey Uckelman

It’s hard to explain. In the picture attached to this post the map zoom is at maximum. Its on a 27 inch 4k screen. As you can see, the VASL preferences window and the font in it is far to big, while the size of the font of the VASSAL window and the size of the icons in the VASL windows are as I would expect it. All this is with the ‘-Dsun.java2d.uiScale=2’ in vassal.vmoptions.

The preference tab is so big, I can’t even click ‘ok’.

Thanks,

Michail

It seems your screenshots got lost in the site migration.

I’m not sure what to advise you to do. You shouldn’t need to set GDK_SCALE or -Dsun.java2d.uiScale at all.

Which version of Java are you using? Can I see an errorLog where you’ve opened a module?

2021-09-11 22:57:44,109 [3239-main] INFO VASSAL.launch.StartUp - Starting
2021-09-11 22:57:44,125 [3239-main] INFO VASSAL.launch.StartUp - OS Linux 5.10.60-1-MANJARO
2021-09-11 22:57:44,125 [3239-main] INFO VASSAL.launch.StartUp - Java version 16.0.2
2021-09-11 22:57:44,125 [3239-main] INFO VASSAL.launch.StartUp - VASSAL version 3.5.8
2021-09-11 22:57:44,488 [3239-AWT-EventQueue-0] INFO VASSAL.launch.ModuleManager - Manager
2021-09-11 22:57:48,411 [3239-SwingWorker-pool-1-thread-1] INFO VASSAL.launch.AbstractLaunchAction - Loading module file /home/lain/VASSAL_V_S/vmods/VASLv662/vasl-6.6.2.vmod
2021-09-11 22:57:48,770 [3239-SwingWorker-pool-1-thread-1] INFO VASSAL.launch.TilingHandler - No images to tile.
2021-09-11 22:57:48,774 [3239-SwingWorker-pool-1-thread-1] INFO VASSAL.launch.AbstractLaunchAction - Loading module VASL
2021-09-11 22:57:48,777 [3239-SwingWorker-pool-1-thread-1] INFO VASSAL.tools.io.ProcessLauncher - launching /usr/lib/jvm/java-16-openjdk/bin/java -Xms512M -Xmx512M -Dsun.java2d.uiScale=2 -Duser.home=/home/lain -Duser.dir=/home/lain/VASSAL-AKT -cp /home/lain/VASSAL-AKT/lib/Vengine.jar VASSAL.launch.Player --load – /home/lain/VASSAL_V_S/vmods/VASLv662/vasl-6.6.2.vmod
2021-09-11 22:57:49,114 [3321-main] INFO VASSAL.launch.StartUp - Starting
2021-09-11 22:57:49,122 [3321-main] INFO VASSAL.launch.StartUp - OS Linux 5.10.60-1-MANJARO
2021-09-11 22:57:49,122 [3321-main] INFO VASSAL.launch.StartUp - Java version 16.0.2
2021-09-11 22:57:49,122 [3321-main] INFO VASSAL.launch.StartUp - VASSAL version 3.5.8
2021-09-11 22:57:49,122 [3321-main] INFO VASSAL.launch.Launcher - Player
2021-09-11 22:57:51,073 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Icon when pieces and draggable overlays are showing:
2021-09-11 22:57:51,073 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Icon when only draggable overlays are showing:
2021-09-11 22:57:51,073 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Icon when only map is showing:
2021-09-11 22:57:53,947 [3321-AWT-EventQueue-0] INFO VASSAL.build.GameModule - VASL version 6.6.2
2021-09-11 22:57:53,971 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Wizard.Next_mnemonic
2021-09-11 22:57:53,971 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Wizard.Prev_mnemonic
2021-09-11 22:57:53,971 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Wizard.Finish_mnemonic
2021-09-11 22:57:53,971 [3321-AWT-EventQueue-0] WARN VASSAL.i18n.BundleHelper - No Translation: Wizard.Cancel_mnemonic
2021-09-11 22:58:02,704 [3321-Thread-0] INFO VASSAL.launch.TilingHandler - No images to tile.
2021-09-11 22:58:02,713 [3321-Thread-0] INFO VASSAL.launch.TilingHandler - No images to tile.

JAVA:
openjdk 16.0.2 2021-07-20
OpenJDK Runtime Environment (build 16.0.2+7)
OpenJDK 64-Bit Server VM (build 16.0.2+7, mixed mode)

Thanks!

Michail

I can see from the log that VASL opened with -Dsun.java2d.uiScale=2 set. Is that screenshot from this run?

The reason you’re getting a dramatically upscaled UI is that flag. The prefs dialog would be the normal size without it. Now that I see the screenshot, I don’t understand what you’re trying to achieve; what I suggested is causing the problem I see in the screenshot, not solving it.

Without the flag the icons are so small, VASL is barely usable. With VASSAL 3.5.5 I had used the GDK_SCALE=2 flag because everything was to small.

VASSAL/VASL without the flag:

Do modules other than VASL look how you’d expect when you don’t supply any extra flags?

I tried it with the La Bataille de Quatre Bras and Next War Poland modules, both had too small icons.

I installed VASSAL/VASL under Windows on the same computer, it scales everything right. The VASL icons under Windows had a width of 9 mm, the one under Linux 0,4 mm. May I just use Windows for now.

Edit: Typos

Have you tried setting GDK_SCALE=2 GDK_DPI_SCALE=0.5 together? The latter is supposed to unscale the text that the former makes too large.

If that doesn’t work, then I might have a diagnostic build for you to try.

Yes, I tried it with both flags. GDK_DPI_SCALE=0.5 has no effect…

I’m not sure what to advise you to do. You shouldn’t need to set GDK_SCALE or -Dsun.java2d.uiScale at all.

I’ve uploaded a test build for you to try.

Open a module with the test build and load a game, using none of the special flags. It doesn’t matter what module you choose, so long as a map gets displayed. Once a map has been displayed, check the error log.

You should see lines like the following:

2021-09-15 01:50:10,520 [59056-AWT-EventQueue-0] INFO  VASSAL.build.module.Map - os_scale == 1.0
2021-09-15 01:50:10,520 [59056-AWT-EventQueue-0] INFO  VASSAL.build.module.Map - font == java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]

Post these here. Every pair of them will contain the same information. I need to see only one pair.