Bug 487596 - Screenshot region selection broken with fractional scaling on multi-monitor setups (X11)
Summary: Screenshot region selection broken with fractional scaling on multi-monitor s...
Status: RESOLVED DUPLICATE of bug 462860
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 23.08.5
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-26 16:12 UTC by Mahe
Modified: 2024-06-01 09:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 24.02.0
Sentry Crash Report:


Attachments
screenshot showing the bug during Spectacle's region selection mode (974.86 KB, image/png)
2024-05-26 16:14 UTC, Mahe
Details
screenshot showing the normal screen contents outside of Spectacle (1.25 MB, image/png)
2024-05-26 16:15 UTC, Mahe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mahe 2024-05-26 16:12:44 UTC
SUMMARY

When Spectacle is used to select a rectangular region (i.e. executing "spectacle --region") on setups using multiple monitors and fractional scaling (on X11), the screen image where the rectangular selection happens shows a distorted and shifted image of the screen.
This makes it impossible to select the correct region as the displayed image does not match the actual screen contents.

STEPS TO REPRODUCE

1. Attach a secondary monitor.
2. Configure monitors to be side by side (see below).
3. In System Settings set global scaling to 125%.
4. Run "spectacle --region". 

Excerpt from "~/.config/kdeglobals":

```
[KScreen]
ScaleFactor=1.25
ScreenScaleFactors=eDP-1=1.25;DP-1=1.25;DP-2=1.25;DP-3=1.25;
```

Example screen alignment as reported by `xrandr`:

```
eDP-1 connected 1600x900+0+180
DP-1 connected primary 1920x1080+1600+0
```

OBSERVED RESULT

The surface where the rectangular selection box is drawn on does not represent the actual screen contents, it displays a distorted image of contents from both screens where areas of the screens are repeated or shifted around.
This mainly affects the primary monitory but if the secondary monitor does not have the same resolution as the primary one, it will also show a distorted image.

After the screenshot has been taken it seems that the actual recording does match the screen contents, only the preview is misrepresenting the state which makes it almost impossible to select the correct region.

EXPECTED RESULT

The screen image during rectangular region selection should represent the actual contents of screens.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Platform: X11

ADDITIONAL INFORMATION

Note 1

The issue can be reproduced using VirtualBox easily utilizing its functionality to attach a second virtual display (if guest additions are installed) and reproducing a screen arrangement as described above accordingly.

Note 2

The issue is not exclusive to Kubuntu.
It also affects the following NixOS configuration:

Linux/KDE Plasma: NixOS 23.11
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.12
Platform: X11

Note 3

LXQt's screenshot tool ("screengrab") seems to suffer from similar issues and its author suspects it to be a Qt bug related to screen coordinates: https://github.com/lxqt/screengrab/issues/211
Comment 1 Mahe 2024-05-26 16:14:15 UTC
Created attachment 169854 [details]
screenshot showing the bug during Spectacle's region selection mode
Comment 2 Mahe 2024-05-26 16:15:25 UTC
Created attachment 169855 [details]
screenshot showing the normal screen contents outside of Spectacle

I've added 2 screenshots: one was taken during Spectacle's region selection mode and one was taken outside of Spectacle for comparison.
Comment 3 Mario Ebenhofer 2024-06-01 09:47:24 UTC
I've had this issue on an older version of Spectacle, too. It should be fixed in a later version (apparently 24.02.0).
See https://bugs.kde.org/show_bug.cgi?id=462860
Comment 4 Mario Ebenhofer 2024-06-01 09:57:38 UTC

*** This bug has been marked as a duplicate of bug 462860 ***