https://bugs.kde.org/show_bug.cgi?id=528044

            Bug ID: 528044
           Summary: Rectangle Captures Incorrectly or Falls Back to
                    Fullscreen
    Classification: Applications
           Product: Spectacle
      Version First 6.6.6
       Reported In:
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: General
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

DESCRIPTION

Attempting to perform a rectangle region capture either captures the screen
incorrectly or it falls back to a fullscreen screenshot.

I am using a Lenovo laptop with an attached external monitor via a dock.

I am experiencing the problem when the laptop lid is closed.
When the laptop lid is open, screenshots are correctly captured.

STEPS TO REPRODUCE
1. Start Spectacle
2. If it's not already in Rectangle Region mode, choose Rectangle Region mode
3. Click and drag your rectangle

OBSERVED RESULT

Either:
- The screenshot captured is the correct shape/size, but it has rectangular
sub-regions that are overlapping and/or simply white.
- Or the screenshot captured is of the entire screen.

EXPECTED RESULT

A correct screenshot of the region I selected.

SOFTWARE/OS VERSIONS
matt@MH-LENOVO-P14S:~/Downloads$ kinfo
Operating System: Kubuntu 26.04 LTS
KDE Plasma Version: 6.6.6
KDE Frameworks Version: 6.24.0
Qt Version: 6.10.2
Kernel Version: 7.0.0-38-generic (64-bit)
Graphics Platform: Wayland
Processors: 16 × Intel® Core™ Ultra 9 386H
Memory: 96 GiB of RAM (93.7 GiB usable)
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: NVIDIA RTX PRO 1000 Blackwell Generation Laptop GPU

ADDITIONAL INFORMATION

Here's a command line reproduction (lid closed):

```
matt@MH-LENOVO-P14S:~/Downloads$ spectacle -b -n -r -o /tmp/region.png
file /tmp/region.png
spectacle: Attempting to use Tesseract library "libtesseract.so.5"
spectacle: Detected Tesseract version "5.5.0"
spectacle: Loaded Tesseract runtime library from "libtesseract.so.5"
` void AnnotationDocumentPrivate::setCanvas(const QRectF&, qreal, const
std::optional<QMatrix4x4>&) `:
        `rect` is empty. This should not happen.
/tmp/region.png: PNG image data, 1920 x 1080, 8-bit/color RGBA, non-interlaced
```

The resulting PNG is full-screen.

SELF DIAGNOSTICS AND A WORKAROUND

SETUP
Laptop panel (eDP-1, 3072x1920 @ 1.65 scale) mirrored to an external monitor
(DP-1, 1920x1080 @ 1.0) while the lid is open. Then close the lid.

LID-CLOSED STATE (kscreen-doctor -o)
  eDP-1: disabled, replication source:0, Geometry 0,0 1862x1164
  DP-1:  enabled,  replication source:1, Geometry 1862,0 1920x1080

So the only enabled output is still marked as a replica of the disabled panel,
and it sits at x=1862 (the panel's logical width), leaving nothing at 0,0.
This matches the analysis in comment 9.

RESULT
  spectacle -b -n -r -o /tmp/region.png
The selection overlay appears and I drag a rectangle, but it prints:
  AnnotationDocumentPrivate::setCanvas(...): `rect` is empty. This should not
happen.
and saves the full 1920x1080 screen. No crash in my case. A full-screen capture
(-f) is correct and matches the screen.

ATTEMPTED FIX 1: moving the output is rejected
  kscreen-doctor output.DP-1.position.0,0
  -> applying config failed! Position of enabled output DP-1 is negative
     (-2147483647, -2147483647)

WORKAROUND THAT WORKS: clearing the replica
  kscreen-doctor output.DP-1.mirror.none
DP-1 changes to replication source:0 and moves to 0,0 automatically.
The same region capture then works correctly (628x461, no warning).

PERSISTENCE
After opening the lid (mirroring still works as before) and closing it again,
DP-1 stays at replication source:0 / 0,0, and region captures keep working
(519x368). The fixed lid-closed layout appears to be saved.

DISPLAY SETTINGS SYMPTOM
With the lid closed, before the workaround, the "Edit Arrangement" area in
System Settings → Display & Monitor was completely blank. After
`mirror.none`, it shows the external monitor centred at 0,0. This may be the
KCM receiving the same invalid position (-2147483647) that kscreen-doctor
reported.

SUMMARY
The trigger seems to be a lid-closed layout where the only enabled output is
still a replica of the disabled internal panel, so it keeps a non-zero offset.
Spectacle could probably handle an output layout that doesn't start at 0,0;
separately, KWin/KScreen arguably shouldn't leave an enabled output replicating
a disabled one.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to