SUMMARY In X11StandaloneBackend::doUpdateOutputs(), X11Output::State::scale is never set, leaving it at the default 1.0 value. This causes CaptureArea and CaptureWorkspace from the ScreenShot2 DBus API to return an incorrect image in a Plasma 6 X11 session when the global scale is not 100%. STEPS TO REPRODUCE 1. In the Display Configuration KCM, set the global scale to 125%. 2. Reboot and log into a Plasma 6 X11 session. 3. Run `spectacle -if` to take a screenshot of the whole workspace. OBSERVED RESULT The image is smaller than it should be and doesn't actually contain the whole workspace. EXPECTED RESULT The image should have a size equal to the virtual desktop size multiplied by the highest screen scale in the virtual desktop. The image should also contain the whole workspace. SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20230917 KDE Plasma Version: 5.27.80 KDE Frameworks Version: 5.240.0 Qt Version: 6.5.2 Kernel Version: 6.5.3-1-default (64-bit) Graphics Platform: X11 Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics Memory: 30.8 GiB of RAM Graphics Processor: AMD Radeon Graphics ADDITIONAL INFORMATION If you put `qDebug() << output->scale()` in X11StandaloneBackend::doUpdateOutputs() to get the scales of the outputs, you will see that it is always 1.0
In `QFuture<QImage> ScreenShotEffect::scheduleScreenShot(const QRect &area, ScreenShotFlags flags)`, if I use QScreen::devicePixelRatio() to get the screen scales, then the returned image is correct. It currently uses KWin::EffectScreen::devicePixelRatio(), which gets its value from the scale for the platform dependent KWin::Output subclass.
1.0 is expected. Logical and device pixels are the same. Can you expand on >to return an incorrect image
(In reply to David Edmundson from comment #2) > 1.0 is expected. > Logical and device pixels are the same. > > Can you expand on > > >to return an incorrect image The image is smaller than it should be and doesn't actually contain the whole workspace. For example, let's say you have two 1920x1080 screens horizontally next to each other with 1.25x scale. The unscaled virtual desktop size is 3840x1080. If you get an image of the whole workspace, you get a 3072x864 image with the right and bottom parts of the workspace cut off. This is different from the behavior on Wayland where the image dimensions match the unscaled virtual desktop size and the image contains the entire workspace. I looked at the code and the reason why is because WaylandOutput gives a correct device pixel ratio, but the X11Output does not, even though QScreen gives a correct device pixel ratio on X11. I think QScreen has different results from X11Output because plasma-workspace/startkde/startplasma-x11.cpp sets QT_SCREEN_SCALE_FACTORS using the settings defined using the Display Configuration KCM.
X11Output::scale() returning 1 on X11 is fully intentional and I'm afraid that we cannot change it as it's going to have some repercussions. Maybe spectacle needs to handle this case somehow. --- Removing qt6 because it's not really a new Plasma 6 issue. kwin has been behaving like this forever.
(In reply to Vlad Zahorodnii from comment #4) > X11Output::scale() returning 1 on X11 is fully intentional and I'm afraid > that we cannot change it as it's going to have some repercussions. Maybe > spectacle needs to handle this case somehow. > > --- > > Removing qt6 because it's not really a new Plasma 6 issue. kwin has been > behaving like this forever. Spectacle can't handle it because the image it gets is faulty, as described above. The issue only occurs on X11 with scaling. I suppose we could make the ScreenShot2 effect use QScreen instead of EffectScreen to get screen geometry.