Bug 505526 - Rectangular Region Screenshot Captures Only Zoomed-In Top-Right Corner of Screen
Summary: Rectangular Region Screenshot Captures Only Zoomed-In Top-Right Corner of Screen
Status: RESOLVED NOT A BUG
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 6.3.5
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-12 15:06 UTC by Akira
Modified: 2025-06-20 16:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.4.0
Sentry Crash Report:


Attachments
This video demonstrates a bug in Spectacle when attempting to take a rectangular region screenshot. (1.04 MB, video/x-matroska)
2025-06-12 15:06 UTC, Akira
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Akira 2025-06-12 15:06:52 UTC
Created attachment 182229 [details]
This video demonstrates a bug in Spectacle when attempting to take a rectangular region screenshot.

SUMMARY

When attempting to take a rectangular region screenshot using Spectacle, the tool consistently captures only the top-right portion of the screen and appears to zoom in on that area. As a result, it is impossible to select or capture the full screen region accurately.

This issue seems related to missing or incorrect viewport or scaling logic, which causes the screenshot preview or capture area not to reflect the full screen properly.

STEPS TO REPRODUCE
1. Open Spectacle
2. Select "Rectangular Region" mode
3. Attempt to draw a selection over the full screen

OBSERVED RESULT

Rectangular Region Screenshot Captures Only Zoomed-In Top-Right Corner of Screen

EXPECTED RESULT

The full screen should be available for region selection, and no zooming or misalignment should occur.

SOFTWARE/OS VERSIONS

Operating System: Arch Linux 
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.1
Kernel Version: 6.15.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1155G7 @ 2.50GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Intel® Iris® Xe Graphics
Comment 1 Nate Graham 2025-06-12 16:22:42 UTC
Eek, yeah, this one. This should be fixed in Plasma 6.4.0.
Comment 2 Akira 2025-06-19 12:58:39 UTC
(In reply to Nate Graham from comment #1)
> Eek, yeah, this one. This should be fixed in Plasma 6.4.0.

It seems like the issue still persists in spectacle 6.4.0. Tested with a new user and clean profile. Maybe this issue should be reopened?
Please let me know if there’s any additional information or logs I can provide to help with debugging.

System info:
Operating System: Arch Linux 
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.10.0
Kernel Version: 6.15.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × 11th Gen Intel® Core™ i5-1155G7 @ 2.50GHz
Memory: 16 GiB of RAM (15.4 GiB usable)
Graphics Processor: Intel® Iris® Xe Graphics
Manufacturer: HUAWEI
Product Name: BoDE-WXX9
System Version: M1010

Spectacle version:
pacman -Qi spectacle
Name            : spectacle
Version         : 1:6.4.0-1
Description     : KDE screenshot capture utility
Architecture    : x86_64
URL             : https://apps.kde.org/spectacle/
Licenses        : GPL-2.0-or-later
Groups          : plasma
Provides        : None
Depends On      : gcc-libs  glibc  kconfig  kconfigwidgets  kcoreaddons  kcrash  kdbusaddons  kglobalaccel  kguiaddons
                  ki18n  kio  kirigami  kjobwidgets  knotifications  kpipewire  kservice  kstatusnotifieritem
                  kwidgetsaddons  kwindowsystem  kxmlgui  layer-shell-qt  libxcb  opencv  prison  purpose  qt6-base
                  qt6-declarative  qt6-imageformats  qt6-multimedia  qt6-wayland  wayland  xcb-util  xcb-util-cursor
                  xcb-util-image
Optional Deps   : None
Required By     : plasma-meta
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 5.90 MiB
Packager        : Tomaz Canabrava <tcanabrava@archlinux.org>
Build Date      : Wed 18 Jun 2025 06:57:32 PM CST
Install Date    : Thu 19 Jun 2025 08:16:25 PM CST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature
Comment 3 Nate Graham 2025-06-19 13:23:02 UTC
Darn, that's problematic. :/
Comment 4 Noah Davis 2025-06-20 04:26:48 UTC
Unfortunately, I can't reproduce this behavior. I see that you don't have any uncommon screen settings (single FHD@1x screen), so I can't guess what the cause could be.
Comment 5 Akira 2025-06-20 07:43:42 UTC
(In reply to Noah Davis from comment #4)
> Unfortunately, I can't reproduce this behavior. I see that you don't have
> any uncommon screen settings (single FHD@1x screen), so I can't guess what
> the cause could be.

Hi, thanks for the previous replies.

After adding some debug output to SpectacleCore.cpp, it appears that the issue may be caused by mismatch between the canvasRect and the screen geometry in logical pixels.

Output:

Screen: "eDP-1"
  Geometry (logical): QRect(0,0 1536x864)
  Device pixel ratio: 1.25
  Calculated screenRect: QRectF(0,0 1536x864)
  Base image available: true
  Canvas rect: QRectF(0,0 1920x1080)
  Intersects canvas: true

```
diff --git a/src/SpectacleCore.cpp b/src/SpectacleCore.cpp
index aa2e8c6e..23a4f12f 100644
--- a/src/SpectacleCore.cpp
+++ b/src/SpectacleCore.cpp
@@ -1268,6 +1268,23 @@ void SpectacleCore::initCaptureWindows(CaptureWindow::Mode mode)
     const auto screens = qApp->screens();
     for (auto *screen : screens) {
         const auto screenRect = Geometry::mapFromPlatformRect(screen->geometry(), screen->devicePixelRatio());
+
+        qDebug() << "Screen:" << screen->name();
+        qDebug() << "  Geometry (logical):" << screen->geometry();
+        qDebug() << "  Device pixel ratio:" << screen->devicePixelRatio();
+        qDebug() << "  Calculated screenRect:" << screenRect;
+        qDebug() << "  Base image available:" << !m_annotationDocument->baseImage().isNull();
+        qDebug() << "  Canvas rect:" << m_annotationDocument->canvasRect();
+        qDebug() << "  Intersects canvas:" << screenRect.intersects(m_annotationDocument->canvasRect());
+
         // Don't show windows for screens that don't have an image.
         if (!m_videoMode
             && !m_annotationDocument->baseImage().isNull()
```

Then I remembered that some environment variables have been set system-wide:

```
export QT_SCREEN_SCALE_FACTORS=1
export QT_FONT_DPI=120
```

Is this behavior expected, or should Spectacle adjust canvasRect to account for the device pixel ratio?

Thanks again for your help!
Comment 6 Noah Davis 2025-06-20 08:47:38 UTC
(In reply to Akira from comment #5)
> Then I remembered that some environment variables have been set system-wide:
> 
> ```
> export QT_SCREEN_SCALE_FACTORS=1
> export QT_FONT_DPI=120
> ```
> 
> Is this behavior expected, or should Spectacle adjust canvasRect to account
> for the device pixel ratio?
> 
> Thanks again for your help!

Oh, that explains. Don't set font DPI to scale the UI. Instead, use the UI scale setting in the display settings or change your font size.

Spectacle already considers DPR, but the DPR it uses comes from the info passed from KWin about the screenshot KWin gave Spectacle. Maybe KWin is missing something to detect DPR in this situation (intentionally or unintentionally). The official stance is that users shouldn't do UI scaling with custom font DPIs.
Comment 7 Nate Graham 2025-06-20 16:43:40 UTC
Well that explains it. Please don't use this environment variable; it turns on the older unsupported font-based scaling settings, which will be the cause of many other random-feeling scaling problems as well. On Wayland, the supported way to scale everything is in System Settings > Display & Monitor > Scale. This is per-screen too, which is another advantage over font-based scaling.