Position of Widget with Fractional Scaling
-
Hello,
I am a maintainer for flameshot (crossplatform FOSS screenshot application). There is a bug that has been unsolved for a couple years where when a user is on X11 with fractional scaling, the widget that displays the screenshot is not centered on the screen. I am really struggling to figure this out.
I created a minimal working example of this bug and posted it here: https://github.com/borgmanJeremy/mwe_fractional_scaling_bug
If you run the example on X11 with scaling set to 1.0, you will see that the screen shot is perfectly centered on the screen. Once fractional scaling is enabled there is an offset that I have a hard time detecting and fixing.
Here is a picture of what it looks like in a VM with fractional scaling:
Note: the MWE does not have a way to quit and launches in fullscreen. I recommend running it in a VM or be ready to drop to tty to kill it. I didnt want to clutter the code with anything unrelated to the bug.
-
Hi and welcome to devnet,
What distribution are you using ?
Since you mention a VM, can you also provide how you installed it to reproduce that issue ?
-
The picture is from a kubuntu20.10 VM, but I have triggered it on basically every modern distro using X11.
To generally trigger the bug, you just need 2 or more monitors with a scaling factor that !=1. I have also triggered in on my real PC, just easier to troubleshoot in a VM.
My VM is running headless on a home server. Then I use SPICE to stream the video locally. The resolution of the VM is 2x monitors at 1920x1080 and a scale factor of 1.25. The spice driver is great for VM's because by default the resolution of the VM will scale to the window size.
-
Are you using VirtualBox ?
-
I just heard in a presentation that fractional scaling support should be good in Qt 6.
-
A workaround that seem seems to work fine for me on X11 (mesa) is to simply run flameshot with the environment variable:
PLASMA_USE_QT_SCALING=1
sysinfo:
Operating System: Ubuntu 24.04 | KDE Plasma Version: 5.27.11 KDE Frameworks Version 5.115.0 Qt Version: 5.15.13