-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix issue #564, that in wayland fractional scaling situtation, screenshot preview size is wrong. #3869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…nal scaling in KDE plasma desktop in wayland.
…shot preview is wrongly scaled issue. This fix supports that we will use dpr in xcb platform because it is correct in that case.
EDIT: It actually works, see my comment below. Unfortunately, this doesn't seem to work on a multimonitor setup (3 horizontal, 1 vertical - 2 of them have a fraction scaling of 1.45). All screens on the screenshot preview seems to be very much upscaled which makes it rather unusable. This is the screen config I've been using on Sway:
|
Thank you for your testing! Yes, that's true. In theory, it only works on multiple monitors if all monitors share the same fractional ratio. I think it is because Qt doesn't support high dpi on Linux Wayland well. It still doesn't use fractional_scale_v1 for its QWaylandScreen IIRC. And this will cause if you display a physical size image on your screen, it will not render in the logical size, at least the correct one. As far as I know, Qt should render image based on per monitor fractional scaling, but right now it is still based on a interger instead of float. My PR only fixes simple cases. And such fix should be reverted if Qt does its job well. |
@SFBB It seems that I wrote my comment too early, dang! I've tracked the issue back to |
This solved the problem with fractional scaling |
@mmahmoudian I can confirm this fixes fractional scaling issues (at least on KDE). It does not fix other wayland issues, but this is a good step forward. It does not regress anything on MacOS. I have no windows machine to test on. @SFBB have you tested that all 3 of the code paths in the if/else statement are hit under various circumstances? |
@borgmanJeremy I tested it with QT_QPA_PLATFORM=xcb(running as X11 app) and QT_QPA_PLATFORM=wayland(running as wayland app), and the first path gets hit in xcb, and the third path gets hit in wayland. The second path is not tested, but it should be hit when the fractional scaling is set as integer. All hit paths work normally in my single monitor with 1.25 fractional scaling setup. I reported an issue in qt and they said:
But I tested using Qt5, QWindow.devicePixelRatio is still not right, I don't know if Qt6 works... |
Fixing screenshot preview size is not correct because wayland dpr is not correct when using fractional scaling. This fix supports the idea that we will use dpr in the xcb platform because it is correct in that case.
Tested on Manjaro wayland session with fractional scaling of 125%, both QT_QPA_PLATFORM=xcb and QT_QPA_PLATFORM=wayland work as expected.
Multi-monitor environment is not tested because I don't have one.