Open duvh93 opened 4 years ago
I managed to trace back the bug source and wanted to report back.
As fractional scaling (1.25) is enabled, my screen (2560x1440) is seen by Qt at its scaled resolution (2048x1152).
When I ask to "Take Screenshot", the ScreenGrabber calls Gnome via dbus to save a screenshot of the entire desktop into a temporary file which is saved at screen physical resolution (2560x1440). Then the surface is loaded from filesystem and returned back as a Qpixmap to the CaptureWidget constructor and stored in m_context.origScreenshot and m_context.screenshot.
When it's the time to show the image on screen, Qt displays an unscaled 2560x1440 surface on a virtually 2040x1152 screen and this leads to the cropping I was complaining about.
Now, I've tried to work this around by scaling the surface m_context.screenshot in the constructor via the scaled(W,H,...) method where (W,H) are retrieved from Qt information on screen geometry. This works but the resulting image is obviously far from sharp because of the scaling process. I don't know whether we can get a sharp 1:1 image to be annotated on screen but I am confident that at least in the export routines the good image quality can be retrieved by mean of m_context.origScreenshot. It will just be a matter of reapplying all the tools in sequence with their coordinates/sizes correctly scaled back for coherence with the physical size.
I've also noticed that copying to the clipboard is broken on wayland, I only get garbage when pasting onto another client. But I'll open another issue for this.
This issue still exists in 0.8.0.
This may be fixed from: e1214e23e5a2641d585e47aa064cfcbb8a2b6111
Unfortunately it is not :(
Flameshot:
Gnome Screenshot:
Same thing is also happening on my 27" monitor which is not HiDPI...
This actually good news because I also have a 27in non hidpi monitor so I should be able to recreate it. Thanks for reporting back
@duvh93 Thanks for your detailed report. I can confirm your analysis is spot on as to what the issue is. This is an article Qt has which is pretty relevant explaining the difference between "Device Pixels" and "Device Independent Pixels".
As a first fix I think downsampling the raw image by the scaling factor would work okay. I know this would throw some pixels away, but is this really noticeable on an annotated screenshot?
A better fix would be to have QT draw the widget using device pixels instead of device independent pixels, but so far I haven't found a place in QT do do that.
Edit: Actually simply resizing the pixmap will not work. The entire widget needs scaled. This is obvious when you see that the help text and side bar are also cropped. hrmmmmm
Final comment for the night, this is not actually a wayland issue but a general issue with fractional scaling. Now that KDE supports fractional scaling on X, I can create the same issue on X.
It's happening to me at 125%, but when I use it, my display resolution switches to something lower and flips back to normal for a short period of time. Keeps looping while in Flameshot. I use Wayland
I'm having what I think is the same issue, using wayland. My laptop screen is 200% scaling and I have an external monitor at 100%. When I try to use flameshot I get an extremely "zoomed in" section of the screens so I can't use it :disappointed:
I also have a similar issue. Wayland with 1.25 fractional scaling. When starting flameshot gui to take a screenshot, my screen zooms in so the bottom part and the right part of the screen is "outside" of the monitor.
Same issue here with fractional scaling on 4K display - unusable. Suck a shame as Flameshot has been my go to for years. Will reinstall once fixed
Just came by to report I have the same issue using Ubuntu 21.04 on a laptop with fractional scaling.
Any update?
@duvh93 this is not yet fully resolved, but people have suggested some workarounds that have solved the issue. Perhaps the best description can be found here:
https://github.com/flameshot-org/flameshot/issues/564#issuecomment-1054125459
@mmahmoudian it seems that the workarounds only work for KDE, am I correct in that assumption? I tried the one you linked to on Gnome 42 and it doesn't seem to solve it.
Is there another workaround for Gnome?
@rayzorben Fractional scaling on multi-monitor setup are still an issue (if that is the issue you are facing). but Gnome >=41 people typically forget to install xdg-desktop-portal-gnome
which is a remedy for other types of issues.
@mmahmoudian I installed xdg-desktop-portal-gnome
and rebooted, and it didn't fix it. I am not experiencing an issue with fractional scaling on multi-monitor setup. I have a single monitor, laptop, and I am having fractional scaling issues. As in, I have my scaling set to 125%, and when I use flameshot I lose 25% off the bottom and right of the screen.
@mmahmoudian I installed
xdg-desktop-portal-gnome
and rebooted, and it didn't fix it. I am not experiencing an issue with fractional scaling on multi-monitor setup. I have a single monitor, laptop, and I am having fractional scaling issues. As in, I have my scaling set to 125%, and when I use flameshot I lose 25% off the bottom and right of the screen.
Exactly the same issue with me :(
Finally fixed by change flameshot shortcut from:
flameshot gui
to
env QT_AUTO_SCREEN_SCALE_FACTOR=1.5 flameshot gui
in which, 1.5
--->>> Settings
->Display
->Scale: 150%
env QT_AUTO_SCREEN_SCALE_FACTOR=1.5 flameshot gui
Still it doesn't work for me :disappointed:
For Asahi Fedora Remix users:
I faced the same issue and QT_AUTO_SCREEN_SCALE_FACTOR
doesn't work for me.
But there is no problem when I use Flameshot in Asahi Arch (without any env var prefix with QT_
).
Solution: So I copy the binary compiled from Asahi Arch and place it to Asahi Fedora Remix to resolve that.
TODO: I will try on installing it from Fedora Remix with pacman to see if it works.
Same problem on Fedora 39 with Gnome/Wayland. None of the work arounds listed above work for me.
Same issue on Fedora 39 with GNOME 45.2 on Wayland. When executing Flameshot from a keyboard shortcut or a tray icon, Flameshot issues "Cannot capture screen" error. When running via terminal (and laptop display is set at 150% scale), 'flameshot gui' produces a cropped version of the screen.
I disabled fractional scaling (set laptop display back to 100%), and the issue disappears. The only way to get it to work with a shortcut is to create a script that just runs 'flameshot gui', and then calling that script with a shortcut.
If QT_AUTO_SCREEN_SCALE_FACTOR
env works for someone, this snippet might be helpful for sway users using flameshot, it should adapt for currently active output scaling
bindsym $mod+Print exec env QT_SCREEN_SCALE_FACTORS="$(swaymsg -t get_outputs | jq 'map(select(.focused == true) | {type, focused, scale}) | .[0].scale | if . then . else 1 end | 1 / .')" flameshot gui
Worked for me on archlinux & sway
Finally fixed by change flameshot shortcut from:
flameshot gui
toenv QT_AUTO_SCREEN_SCALE_FACTOR=1.5 flameshot gui
in which,1.5
--->>>Settings
->Display
->Scale: 150%
env QT_AUTO_SCREEN_SCALE_FACTOR=1 flameshot
work nice for me!!!!
Flameshot v12.1.0 ()
Compiled with Qt 5.11.3
Still having this issue and none of the (seemingly unrelated fixes) works. The comment https://github.com/flameshot-org/flameshot/issues/748#issuecomment-692155847 seems to describe properly the bug, yet, all that I'm reading everywhere is to try to play with the environment variables.
It seems ppl that says that it works are talking about a completely unrelated issue.
The resulting screen grabbed is a zoomed in copy of the screen, zoomed in by the factor of the fractional scaling configured.
Still having this issue and none of the (seemingly unrelated fixes) works. The comment #748 (comment) seems to describe properly the bug, yet, all that I'm reading everywhere is to try to play with the environment variables.
It seems ppl that says that it works are talking about a completely unrelated issue.
The resulting screen grabbed is a zoomed in copy of the screen, zoomed in by the factor of the fractional scaling configured.
I am with you @mikegleasonjr - I have tried EVERYTHING ON this thread with environment variables, and nothing works. I am on a simple use case - Gnome 46, Wayland, Fractional Scaling, Single Monitor. Nothing I have tried works.
Still having this issue and none of the (seemingly unrelated fixes) works. The comment #748 (comment) seems to describe properly the bug, yet, all that I'm reading everywhere is to try to play with the environment variables. It seems ppl that says that it works are talking about a completely unrelated issue. The resulting screen grabbed is a zoomed in copy of the screen, zoomed in by the factor of the fractional scaling configured.
I am with you @mikegleasonjr - I have tried EVERYTHING ON this thread with environment variables, and nothing works. I am on a simple use case - Gnome 46, Wayland, Fractional Scaling, Single Monitor. Nothing I have tried works.
That is my setup as well!
I just setup a fresh install of running Plasma 6.1 on a 1440p monitor. Same boat as you @rayzorben and @mikegleasonjr
I am having the same problem as @mikegleasonjr. I am using the flatpak version on Pop!_OS. Without the suggested environment variables the screens flicker, constantly changing between resolutions, the whole desktop is useless until I hit escape. With the environment variables set I am able to take screenshots, however on my 4k monitor, which uses 125% fractional scaling, it only lets me take a rectangle snip of a cropped portion of the screen. I'd really love for this to be resolved because Flameshot is exactly what I want in a screenshot utility.
Flameshot version Flameshot v0.6.0 Compiled with Qt 5.14.1
Describe the bug I take a screenshot from terminal with "flameshot gui" and the resulting file is a zoomed blurred version of what I actually see on my screen.
To Reproduce Use an HiDPI screen, set wayland to fractional scaling value (e.g. 125%), use qt5-wayland and export the env var QT_QPA_PLATFORM=wayland, take a screenshot with flameshot gui
Expected behavior What I get should be what I see
What I am getting
What I can see (and get with gnome screenshot binding)