fifty-six / Scarab

An installer for Hollow Knight mods written in Avalonia.
GNU General Public License v3.0
622 stars 166 forks source link

Text is too small on HiDPI display #109

Open l0b0 opened 2 years ago

l0b0 commented 2 years ago

Scarab Version

v1.19.0.0

Hollow Knight Version

N/A

Steps to Reproduce

Run Scarab

Expected Behaviour

The text in the main window should be readable.

Actual Behaviour

The text in the main window doesn't scale with the GNOME display scaling (set to 200% in my case).

Logs

N/A

fifty-six commented 2 years ago

Do you happen to have any pictures? Are you on Wayland or X11?

l0b0 commented 2 years ago

I'm currently on Wayland. My resolution is 3840x2160, and the application is showing up as a 710 × 560 pixel window: Screenshot from 2022-10-06 10-05-57

As you can see the window heading is scaled, but not the contents.

fifty-six commented 2 years ago

Does resizing leave the font size the same?

l0b0 commented 2 years ago

Yep. Here's a maximised screenshot: Screenshot from 2022-10-06 10-10-48

l0b0 commented 2 years ago

I tried AVALONIA_SCREEN_SCALE_FACTORS=XWAYLAND0=2 Scarab as suggested elsewhere (I've got a dual monitor setup, but I'm running the application on XWAYLAND0). That doesn't seem to do anything.

l0b0 commented 2 years ago

Also tried with no discernible difference:

fifty-six commented 1 year ago

image It seems to be scaled for me on Wayland with river (4k monitor, 2x scale). Does wlr-randr report the display having Scale: 2.00000? Sorry this took so long, have been very busy

l0b0 commented 1 year ago

With:

Scarab does not scale: Screenshot from 2022-12-05 17-46-32

wlr-randr says

compositor doesn't support wlr-output-management-unstable-v1

I guess the equivalent in GNOME is this:

$ gsettings get org.gnome.desktop.interface scaling-factor
uint32 2
fifty-six commented 1 year ago

Alright, I'll get gnome and try this out when I get the chance - might be a bit as finals are next week

l0b0 commented 1 year ago

Alright, I'll get gnome and try this out when I get the chance - might be a bit as finals are next week

Thank you, and good luck with the finals!

fifty-six commented 1 year ago

Sorry, it took me way too long to get around to this - but when I try Scarab under mutter (gnome's WM) with a debug monitor scale of 2 or 4 I can reproduce (somewhat) similar results. image Other applications respect the scale properly, but for whatever reason Scarab doesn't.

On river it seems to work fine - image.

However, I did have luck with AVALONIA_SCREEN_SCALE_FACTORS. image Interestingly enough, it didn't have XWAYLAND0/1/... as the display name.

So I then went and looked back at xrandr's active displays on river...

% xrandr --listactivemonitors
Monitors: 3
 0: +DP-2 1920/620x1080/340+1920+0  DP-2
 1: +DP-3 2560/600x1440/340+3840+0  DP-3
 2: +HDMI-A-1 1920/480x1080/270+0+0  HDMI-A-1
%                                                                                                                       ~

and it seems to just fake actual monitors, which would explain the scaling working (somewhat) correctly. DP-3 is actually my 4k display.

So, the question I have at the end of this is, are you sure it's XWAYLAND0 that Scarab is running on? When you run xrandr --listactivemonitors is that the only one there?

If you're curious by the way, you can try nested mutter as follows

MUTTER_DEBUG_DUMMY_MONITOR_SCALES=2 MUTTER_DEBUG_DUMMY_MODE_SPECS=1920x1080 mutter --wayland --nested -- alacritty

(alacritty just being for the sake of it being easier to launch applications, you could replace it with whatever.)

l0b0 commented 1 year ago

Thanks for looking into this! I only have a single monitor:

$ xrandr --listactivemonitors
Monitors: 1
 0: +*XWAYLAND27 3840/940x2160/530+0+0  XWAYLAND27

It looks like monitor numbering must've changed recently, because it really was on XWAYLAND0 before. :shrug:

I don't have alacritty, mutter, or avalonia installed.

I'm going to completely randomly guess that the problem is with whatever GUI framework Scarab is using. Does their official documentation have any info about supporting display scaling?

fifty-six commented 1 year ago

The GUI framework is Avalonia to be clear, so the thing linked to by the issue you found is basically all. Could you double check that with AVALONIA_SCREEN_SCALE_FACTORS="XWAYLAND27=2" ./../wherever/Scarab the scaling doesn't work and that with it running XWAYLAND27 is still the only active display in xrandr?

l0b0 commented 1 year ago

Sorry, AVALONIA_SCREEN_SCALE_FACTORS="XWAYLAND27=2" Scarab doesn't scale the windows, and xrandr --listactivemonitors while Scarab is running still reports XWAYLAND27 as the only active display.

l0b0 commented 1 year ago

Sorry, AVALONIA_SCREEN_SCALE_FACTORS="XWAYLAND27=2" Scarab doesn't scale the windows, and xrandr --listactivemonitors while Scarab is running still reports XWAYLAND27 as the only active display.

I'm running Scarab 1.19.0.0 though, so I should probably upgrade.

fifty-six commented 1 year ago

Could you try running it under MUTTER_DEBUG_DUMMY_MONITOR_SCALES=2 MUTTER_DEBUG_DUMMY_MODE_SPECS=1920x1080 mutter --wayland --nested -- terminal (terminal being your terminal of choice)? You'd still check xrandr --listactivemonitors there and set the variable, but I'm curious as to whether it doesn't manifest in nested stuff or in just mutter itself. mutter is part of GNOME (it's gnome.mutter in nixpkgs), so you should have it. 1.19.0.0 shouldn't be any different wrt this issue, though I'd still recommend upgrading when you get the chance.

l0b0 commented 1 year ago

Main console output:

$ MUTTER_DEBUG_DUMMY_MONITOR_SCALES=2 MUTTER_DEBUG_DUMMY_MODE_SPECS=1920x1080 mutter --wayland --nested -- gnome-terminal
libmutter-Message: 20:12:44.424: Running Mutter (using mutter 43.2) as a Wayland display server
amdgpu: amdgpu_cs_ctx_create2 failed. (-13)
amdgpu: amdgpu_cs_ctx_create2 failed. (-13)
libmutter-Message: 20:12:44.498: Using public X11 display :2, (using :3 for managed services)

(mutter:690995): libmutter-WARNING **: 20:12:44.498: WL: unable to lock lockfile /run/user/1000/wayland-0.lock, maybe another compositor is running

libmutter-Message: 20:12:44.498: Using Wayland display name 'wayland-1'

(mutter:690995): libmutter-WARNING **: 20:12:44.510: Lost or failed to acquire name org.gnome.Mutter.ScreenCast

(mutter:690995): libmutter-WARNING **: 20:12:44.510: Lost or failed to acquire name org.gnome.Mutter.RemoteDesktop

Terminal output inside mutter:

$ xrandr --listactivemonitors
Can't open display :2

Scarab crashed. From the error log:

System.Exception: XOpenDisplay failed
   at Avalonia.X11.AvaloniaX11Platform.Initialize(X11PlatformOptions options) in /_/src/Avalonia.X11/X11Platform.cs:line 57
   at Avalonia.AvaloniaX11PlatformExtensions.<>c__0`1.<UseX11>b__0_0() in /_/src/Avalonia.X11/X11Platform.cs:line 279
   at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 303
   at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 179
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 208
   at Scarab.Program.Main(String[] args) in /build/source/Scarab/Program.cs:line 27

(Mutter isn't installed by default with GNOME, but I just installed it with nix-shell -p gnome.mutter.)

fifty-six commented 1 year ago

Oh, hmm. If you wanted, you could try sway or river or similar and see if that works, though I'd understand if that's too much effort. I checked straight up GNOME instead of nested in case that was the issue, but it seems to work for me with the variables set, strangely enough. sshot If that doesn't go anywhere or it's too much effort, I can try messing around with stuff a bit more, might need to try a different distro because I know I used to have XWAYLAND displays instead of the individual ones, so I think that might be from some upgrade I've done at some point given it's happening on both gnome and river

l0b0 commented 1 month ago

FYI AVALONIA_GLOBAL_SCALE_FACTOR=2 Scarab works on GNOME+Wayland.