fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
24.81k stars 1.37k forks source link

Incorrect window scaling in Gnome Boxes VMs #4886

Open Jacalz opened 4 months ago

Jacalz commented 4 months ago

Checklist

Describe the bug

The calculations for determining the default Window scale seem to not be working when running Gnome or KDE Plasma in the Gnome Boxes virtual machine manager (haven't tested any other tech like VMWare etc.).

I have attached various comparison images below to showcase this issue.

How to reproduce

  1. Start fyne_demo and notice that the scaling is incorrect.
  2. Open the theme settings and change scaling.

Screenshots

As you can see, the scale is entirely different from Gnome and it isn't quite possible to get it to a good scale factor when using the settings. The comparison images used Rymdport but fyne_demo should work fine as well. The scaling problem is the same on Gnome and Plasma but images uses Plasma for showing wrong scale:

Local vs VM window with normal text size:

image

Setting text size to small on VM is still too large:

image

Setting text size to tiny on VM is too small:

image

Example code

Use fyne_demo and the menu to then open the theme settings.

Fyne version

v2.4.5

Go compiler version

1.22.3

Operating system and version

Fedora Kinoite 40

Additional Information

Display hardware

All of these tests were conducted on a 27" 1440p monitor.

Reported scaling values locally:

image

Reported scaling values from the VM:

image

Jacalz commented 4 months ago

This looks really bad. Given how unusable this makes Fyne apps on Plasma, I'd almost be tempted to label this as a release blocker.

andydotxyz commented 4 months ago

Gnome vs Plasma window with normal text size:

How are you managing to run both on the same screen?

Is it possible that one is X11 and the other Wayland?

Jacalz commented 4 months ago

How are you managing to run both on the same screen?

I had the Plasma VM in fullscreen mode and then ungrabbed the mouse pointer from the VM, pressed the super key to enter the overdrive and lastly focused the window running on Gnome. There is no image editing involved.

Is it possible that one is X11 and the other Wayland?

As far as I know, no. Both apps are running in X11-mode through XWayland. Fedora 40 on Plasma does not support the pure X11 session (entirely removed in favour of XWayland). I had Wayland builds running on the same session as part of that testing. My Gnome setup is also running Wayland.

dweymouth commented 4 months ago

I agree with Jacob - this is really bad and should be one of the top priority fixes. It does seem like Fyne apps are almost entirely unusable on KDE Plasma as it is now

dweymouth commented 4 months ago

I'm surprised I haven't had anyone report this though for Supersonic

andydotxyz commented 4 months ago

How are you managing to run both on the same screen?

I had the Plasma VM in fullscreen mode and then ungrabbed the mouse pointer from the VM, pressed the super key to enter the overdrive and lastly focused the window running on Gnome. There is no image editing involved.

Is it possible that one is X11 and the other Wayland?

As far as I know, no. Both apps are running in X11-mode through XWayland. Fedora 40 on Plasma does not support the pure X11 session (entirely removed in favour of XWayland). I had Wayland builds running on the same session as part of that testing. My Gnome setup is also running Wayland.

In which case I'd guess this is a duplicate of the issue that Wayland scale is not yet respected.

For scale lookup we use the XRandR information so if this is running as XWayland instead of Wayland then I think that may be the source of the problem. Would be worth getting a report on the xRandR screen information to aid debugging...

Jacalz commented 4 months ago

In which case I'd guess this is a duplicate of the issue that Wayland scale is not yet respected.

You mean https://github.com/fyne-io/fyne/issues/2897? Not necessarily the same given that KDE and Gnome gives entirely different scaling factors. That the application is unusable on KDE is really problematic.

For scale lookup we use the XRandR information so if this is running as XWayland instead of Wayland then I think that may be the source of the problem. Would be worth getting a report on the xRandR screen information to aid debugging...

Neither Gnome or Plasma installs have xrandr installed so I wonder where we get our scaling info from in that case. I installed it and I have attached the reports below.

Xrandr report from Gnome:

Screen 0: minimum 16 x 16, current 4480 x 1440, maximum 32767 x 32767
DP-2 connected primary 2560x1440+1920+0 (normal left inverted right x axis y axis) 600mm x 340mm

Xrandr report from KDE Plasma:

Screen 0: minimum 16 x 16, current 2560 x 1440, maximum 32767 x 32767
DP-2 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 320mm x 200mm
Jacalz commented 4 months ago

I did some more digging into this. It does not seem to be a Wayland/XWayland issue nor KDE Specific in this case. This issue seems to be related to VMs not reporting the screen size correctly. We might need a different way to look up the scaling given that Fedora Workstation (Gnome) and Fedora KDE (KDE Plasma) both have the same scaling issues when running in the VM but neither have it when booting into the live system directly on the hardware.

However, the problem with Steam Deck in https://github.com/Jacalz/rymdport/issues/159 remains. That problem does make Fyne applications entirely unusable on Steam Deck (and maybe other hardware with smaller screens as well?).

Jacalz commented 4 months ago

Opened https://github.com/fyne-io/fyne/issues/4896 to track Steam Deck changes instead. Relabeled this issue for incorrect scaling in virtual machines.

andydotxyz commented 4 months ago

It works for my testing in full virtual machines. How can we replicate this (never heard of gnome boxes before)

Jacalz commented 4 months ago

The virtual machines that Gnome Boxes manages are full virtual machine as far as I know. It is basically a virtualisation manager for libvirt. I believe it is running either through QEMU or KVM. See https://en.m.wikipedia.org/wiki/GNOME_Boxes for more information.

I suppose you could try to install Gnome Boxes on a Linux machine and see if it replicates for you.

andydotxyz commented 3 months ago

We probably need to know more about XWayland, because it is correctly reading the scale info in a pure Wayland environment...