Bug 502047 - Rectangular Region selects on wrong screen with certain screen setups
Summary: Rectangular Region selects on wrong screen with certain screen setups
Status: VERIFIED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 6.3.3
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords: multiscreen
: 500555 501177 502207 502473 502909 505548 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-03-26 21:48 UTC by Jovan Pavlovic
Modified: 2025-06-20 19:10 UTC (History)
17 users (show)

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


Attachments
Showcase of bug (1.51 MB, video/x-matroska)
2025-03-26 21:48 UTC, Jovan Pavlovic
Details
Display arrangement used to reproduce bug, with a marked section of where to take a screenshot. (25.42 KB, image/png)
2025-04-25 20:08 UTC, Jonas Ryssel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jovan Pavlovic 2025-03-26 21:48:55 UTC
Created attachment 179767 [details]
Showcase of bug

SUMMARY


STEPS TO REPRODUCE
1. Have 2 27' monitors in 2560x1440 (16:9)
2. Set both displays to 150% scale
3. Open spectacle with rectangular region select
4. Try to select region on left screen

Issue is not observed when display scale are 100% or 125%

OBSERVED RESULT
Rectangle is selected on right screen (same position as if my left screen would be on right side)

EXPECTED RESULT
Rectangle is selected on left screen

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version:  6.3.3
KDE Frameworks Version:  6.12.0
Qt Version: 6.8.2
Kernel Version 6.13.8-arch1-1
Graphics Platform: Wayland

ADDITIONAL INFORMATION
qdbus org.kde.KWin /KWin supportInformation
KWin Support Information:
The following information should be used when requesting support on e.g. https://discuss.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like https://paste.kde.org instead of pasting into support threads.

==========================

Version
=======
KWin version: 6.3.3
Qt Version: 6.8.2
Qt compile version: 6.8.2
XCB compile version: 1.17.0

Operation Mode: Wayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_X11_XCB: yes
HAVE_GLX: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 12401006
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: kwin4_decoration_qml_plastik
Plugin recommends border size: None
onAllDesktopsAvailable: false
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 0
gridUnit: 10
font: Noto Sans,10,-1,0,400,0,0,0,0,0,0,0,0,0,0,1
smallSpacing: 2
largeSpacing: 10

Output backend
==============
Name: DRM
Atomic Mode Setting on GPU 0: true

Cursor
======
themeName: breeze_cursors
themeSize: 24

Options
=======
focusPolicy: ClickToFocus
xwaylandCrashPolicy: 1
xwaylandMaxCrashCount: 3
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: true
placement: 5
activationDesktopPolicy: SwitchToOtherDesktop
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
edgeBarrier: 100
cornerBarrier: 1
rollOverDesktops: false
focusStealingPreventionLevel: 1
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: MouseRaise
commandActiveTitlebar2: MouseNothing
commandActiveTitlebar3: MouseOperationsMenu
commandInactiveTitlebar1: MouseActivateAndRaise
commandInactiveTitlebar2: MouseNothing
commandInactiveTitlebar3: MouseOperationsMenu
commandWindow1: MouseActivateRaiseOnReleaseAndPassClick
commandWindow2: MouseActivateAndPassClick
commandWindow3: MouseActivateAndPassClick
commandWindowWheel: MouseNothing
commandAll1: MouseUnrestrictedMove
commandAll2: MouseToggleRaiseAndLower
commandAll3: MouseUnrestrictedResize
keyCmdAllModKey: 16777250
doubleClickBorderToMaximize: true
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
compositingMode: 1
useCompositing: true
hiddenPreviews: 1
glSmoothScale: 2
glStrictBinding: true
glStrictBindingFollowsDriver: true
glPreferBufferSwap: AutoSwapStrategy
glPlatformInterface: 2
windowsBlockCompositing: true
allowTearing: true
interactiveWindowMoveEnabled: true

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Number of Screens: 2

Screen 0:
---------
Name: DP-1
Enabled: 1
Geometry: 1707,0,1707x960
Physical size: 597x336mm
Scale: 1.5
Refresh Rate: 164834
Adaptive Sync: never
Screen 1:
---------
Name: DP-2
Enabled: 1
Geometry: 0,0,1707x960
Physical size: 596x335mm
Scale: 1.5
Refresh Rate: 164802
Adaptive Sync: never

Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 6900 XT (radeonsi, navi21, LLVM 19.1.7, DRM 3.61, 6.13.8-arch1-1)
OpenGL version string: 4.6 (Core Profile) Mesa 25.0.2-arch1.2
OpenGL platform interface: EGL
OpenGL shading language version string: 4.60
Driver: Unknown
GPU class: Unknown
OpenGL version: 4.6
GLSL version: 4.60
Mesa version: 25.0.2
X server version: 1.24.1
Linux kernel version: 6.13.8
Direct rendering: Requires strict binding: no
Virtual Machine:  no
OpenGL 2 Shaders are used

Loaded Effects:
---------------
shakecursor
screenshot
outputlocator
colorpicker
zoom
screenedge
blur
contrast
login
sessionquit
logout
slidingpopups
windowaperture
slide
fadingpopups
maximize
frozenapp
scale
fullscreen
squash
dialogparent
windowview
tileseditor
overview
highlightwindow
blendchanges
startupfeedback
systembell
screentransform
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
shakecursor:

screenshot:

outputlocator:

colorpicker:

zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
focusTrackingEnabled: false
textCaretTrackingEnabled: false
focusDelay: 350
moveFactor: 20
targetZoom: 1

screenedge:

blur:

contrast:

login:
pluginId: login
isActiveFullScreenEffect: false

sessionquit:
pluginId: sessionquit
isActiveFullScreenEffect: false

logout:
pluginId: logout
isActiveFullScreenEffect: false

slidingpopups:
slideInDuration: 200
slideOutDuration: 200

windowaperture:
pluginId: windowaperture
isActiveFullScreenEffect: false

slide:
horizontalGap: 45
verticalGap: 20
slideBackground: true

fadingpopups:
pluginId: fadingpopups
isActiveFullScreenEffect: false

maximize:
pluginId: maximize
isActiveFullScreenEffect: false

frozenapp:
pluginId: frozenapp
isActiveFullScreenEffect: false

scale:
pluginId: scale
isActiveFullScreenEffect: false

fullscreen:
pluginId: fullscreen
isActiveFullScreenEffect: false

squash:
pluginId: squash
isActiveFullScreenEffect: false

dialogparent:
pluginId: dialogparent
isActiveFullScreenEffect: false

windowview:
activeView: 
delegate: 
animationDuration: 300
ignoreMinimized: false
mode: 
partialActivationFactor: 0
gestureInProgress: false
searchText: 
selectedIds: 

tileseditor:
activeView: 
delegate: 
animationDuration: 200

overview:
activeView: 
delegate: 
animationDuration: 300
ignoreMinimized: false
filterWindows: true
organizedGrid: true
overviewPartialActivationFactor: 0
overviewGestureInProgress: false
transitionPartialActivationFactor: 0
transitionGestureInProgress: false
gridPartialActivationFactor: 0
gridGestureInProgress: false
desktopOffset: 
searchText: 

highlightwindow:

blendchanges:

startupfeedback:
type: 1

systembell:

screentransform:

kscreen:


Loaded Plugins:
---------------
BounceKeysPlugin
KeyNotificationPlugin
StickyKeysPlugin
buttonsrebind
eis
krunnerintegration
nightlight
screencast

Available Plugins:
------------------
BounceKeysPlugin
KeyNotificationPlugin
StickyKeysPlugin
buttonsrebind
eis
krunnerintegration
nightlight
screencast
Comment 1 Oliver Beard 2025-03-27 21:07:56 UTC
This issue has been seen by another user with 150% scale, I'm collecting more information from them.

Can you, Jovan, please provide the output of the following command:
  kscreen-console outputs
Comment 2 Oliver Beard 2025-03-27 21:38:30 UTC
Additionally, do you see this issue with the monitors positioned in the opposite configuration? (i.e. with your HP display on the left? Please make sure the command output provided is with the original display configuration where this problem is seen!)
Comment 3 Nate Graham 2025-03-31 18:49:21 UTC
I'm not able to reproduce this at all on git master with multiple screens (laptop 14" 2880x1800@175% + external 23" 2560x1440@100%) no matter how I arrange them.
Comment 4 Nate Graham 2025-03-31 20:10:44 UTC
*** Bug 502207 has been marked as a duplicate of this bug. ***
Comment 5 Jovan Pavlovic 2025-03-31 20:36:11 UTC
(In reply to Oliver Beard from comment #1)
> This issue has been seen by another user with 150% scale, I'm collecting
> more information from them.
> 
> Can you, Jovan, please provide the output of the following command:
>   kscreen-console outputs

kscreen-console outputs
START: Requesting Config
Received config. Took 4 milliseconds
Screen:
        maxSize: QSize(64000, 64000)
        minSize: QSize(0, 0)
        currentSize: QSize(3414, 960)

-----------------------------------------------------

Id:  1
Name:  "DP-1"
Type:  "DisplayPort"
Connected:  true
Enabled:  true
Priority:  2
Rotation:  KScreen::Output::None
Pos:  QPoint(1707,0)
MMSize:  QSize(597, 336)
FollowPreferredMode:  false
Size:  QSize(2560, 1440)
Scale:  1.5
Clones:  None
Mode:  "2"
Preferred Mode:  "1"
Preferred modes:  QList("1")
Modes: 
         "1"    "2560x1440@60"   QSize(2560, 1440)   59.951
         "10"    "1920x1080@60"   QSize(1920, 1080)   60
         "11"    "1920x1080@60"   QSize(1920, 1080)   60
         "12"    "1920x1080@60"   QSize(1920, 1080)   59.94
         "13"    "1600x1200@60"   QSize(1600, 1200)   59.951
         "14"    "1680x1050@60"   QSize(1680, 1050)   59.954
         "15"    "1600x900@60"   QSize(1600, 900)   60
         "16"    "1280x1024@75"   QSize(1280, 1024)   75.025
         "17"    "1280x1024@60"   QSize(1280, 1024)   60.02
         "18"    "1440x900@60"   QSize(1440, 900)   59.887
         "19"    "1280x800@60"   QSize(1280, 800)   59.81
         "2"    "2560x1440@165"   QSize(2560, 1440)   164.834
         "20"    "1280x720@60"   QSize(1280, 720)   60
         "21"    "1280x720@60"   QSize(1280, 720)   60
         "22"    "1280x720@60"   QSize(1280, 720)   59.94
         "23"    "1024x768@75"   QSize(1024, 768)   75.029
         "24"    "1024x768@60"   QSize(1024, 768)   60.004
         "25"    "800x600@75"   QSize(800, 600)   75
         "26"    "800x600@60"   QSize(800, 600)   60.317
         "27"    "720x480@60"   QSize(720, 480)   60
         "28"    "720x480@60"   QSize(720, 480)   60
         "29"    "720x480@60"   QSize(720, 480)   59.94
         "3"    "2560x1440@144"   QSize(2560, 1440)   143.973
         "30"    "720x480@60"   QSize(720, 480)   59.94
         "31"    "640x480@75"   QSize(640, 480)   75
         "32"    "640x480@60"   QSize(640, 480)   60
         "33"    "640x480@60"   QSize(640, 480)   59.94
         "34"    "640x480@60"   QSize(640, 480)   59.94
         "35"    "720x400@70"   QSize(720, 400)   70.082
         "36"    "1600x1200@60"   QSize(1600, 1200)   59.869
         "37"    "1280x1024@60"   QSize(1280, 1024)   59.895
         "38"    "1024x768@60"   QSize(1024, 768)   59.92
         "39"    "2560x1440@60"   QSize(2560, 1440)   59.961
         "4"    "2560x1440@120"   QSize(2560, 1440)   119.998
         "40"    "1920x1080@60"   QSize(1920, 1080)   59.963
         "41"    "1600x900@60"   QSize(1600, 900)   59.946
         "42"    "1368x768@60"   QSize(1368, 768)   59.882
         "43"    "1280x720@60"   QSize(1280, 720)   59.855
         "5"    "2560x1440@75"   QSize(2560, 1440)   74.971
         "6"    "1920x1200@60"   QSize(1920, 1200)   59.885
         "7"    "1920x1080@120"   QSize(1920, 1080)   120
         "8"    "1920x1080@120"   QSize(1920, 1080)   119.88
         "9"    "1920x1080@100"   QSize(1920, 1080)   100
EDID Info: 
        Device ID:  "xrandr-HP Inc.-OMEN 27q-CNC3232K8F"
        Name:  "OMEN 27q"
        Vendor:  "HP Inc."
        Serial:  "CNC3232K8F"
        EISA ID:  ""
        Hash:  "7997badb50a48267c23bcec31525ae70"
        Width:  60
        Height:  34
        Gamma:  2.2
        Red:  QQuaternion(scalar:1, vector:(0.68457, 0.308594, 0))
        Green:  QQuaternion(scalar:1, vector:(0.277344, 0.648438, 0))
        Blue:  QQuaternion(scalar:1, vector:(0.144531, 0.0595703, 0))
        White:  QQuaternion(scalar:1, vector:(0.313477, 0.329102, 0))

-----------------------------------------------------

Id:  2
Name:  "DP-2"
Type:  "DisplayPort"
Connected:  true
Enabled:  true
Priority:  1
Rotation:  KScreen::Output::None
Pos:  QPoint(0,0)
MMSize:  QSize(596, 335)
FollowPreferredMode:  false
Size:  QSize(2560, 1440)
Scale:  1.5
Clones:  None
Mode:  "46"
Preferred Mode:  "44"
Preferred modes:  QList("44")
Modes: 
         "44"    "2560x1440@60"   QSize(2560, 1440)   59.94
         "45"    "2560x1440@170"   QSize(2560, 1440)   169.831
         "46"    "2560x1440@165"   QSize(2560, 1440)   164.802
         "47"    "2560x1440@144"   QSize(2560, 1440)   143.856
         "48"    "2560x1440@120"   QSize(2560, 1440)   119.879
         "49"    "1920x1200@60"   QSize(1920, 1200)   59.94
         "50"    "1920x1080@144"   QSize(1920, 1080)   143.854
         "51"    "1920x1080@120"   QSize(1920, 1080)   120
         "52"    "1920x1080@120"   QSize(1920, 1080)   119.88
         "53"    "1920x1080@60"   QSize(1920, 1080)   60
         "54"    "1920x1080@60"   QSize(1920, 1080)   60
         "55"    "1920x1080@60"   QSize(1920, 1080)   59.94
         "56"    "1600x1200@60"   QSize(1600, 1200)   59.94
         "57"    "1680x1050@60"   QSize(1680, 1050)   59.954
         "58"    "1280x1024@75"   QSize(1280, 1024)   75.025
         "59"    "1280x1024@60"   QSize(1280, 1024)   60.02
         "60"    "1440x900@60"   QSize(1440, 900)   59.887
         "61"    "1280x800@60"   QSize(1280, 800)   59.94
         "62"    "1280x720@120"   QSize(1280, 720)   120
         "63"    "1280x720@120"   QSize(1280, 720)   119.88
         "64"    "1280x720@60"   QSize(1280, 720)   60
         "65"    "1280x720@60"   QSize(1280, 720)   59.94
         "66"    "1024x768@75"   QSize(1024, 768)   75.029
         "67"    "1024x768@70"   QSize(1024, 768)   70.069
         "68"    "1024x768@60"   QSize(1024, 768)   60.004
         "69"    "800x600@75"   QSize(800, 600)   75
         "70"    "800x600@72"   QSize(800, 600)   72.188
         "71"    "800x600@60"   QSize(800, 600)   60.317
         "72"    "800x600@56"   QSize(800, 600)   56.25
         "73"    "720x576@50"   QSize(720, 576)   50
         "74"    "720x576@50"   QSize(720, 576)   50
         "75"    "720x480@60"   QSize(720, 480)   60
         "76"    "720x480@60"   QSize(720, 480)   60
         "77"    "720x480@60"   QSize(720, 480)   59.94
         "78"    "720x480@60"   QSize(720, 480)   59.94
         "79"    "640x480@75"   QSize(640, 480)   75
         "80"    "640x480@73"   QSize(640, 480)   72.809
         "81"    "640x480@60"   QSize(640, 480)   60
         "82"    "640x480@60"   QSize(640, 480)   59.94
         "83"    "1600x1200@60"   QSize(1600, 1200)   59.869
         "84"    "1280x1024@60"   QSize(1280, 1024)   59.895
         "85"    "1024x768@60"   QSize(1024, 768)   59.92
         "86"    "1920x1200@60"   QSize(1920, 1200)   59.885
         "87"    "1280x800@60"   QSize(1280, 800)   59.81
         "88"    "2560x1440@60"   QSize(2560, 1440)   59.961
         "89"    "1920x1080@60"   QSize(1920, 1080)   59.963
         "90"    "1600x900@60"   QSize(1600, 900)   59.946
         "91"    "1368x768@60"   QSize(1368, 768)   59.882
         "92"    "1280x720@60"   QSize(1280, 720)   59.855
EDID Info: 
        Device ID:  "xrandr-GIGA-BYTE TECHNOLOGY CO., LTD.-M27Q-21030B003556"
        Name:  "M27Q"
        Vendor:  "GIGA-BYTE TECHNOLOGY CO., LTD."
        Serial:  "21030B003556"
        EISA ID:  ""
        Hash:  "e6936a5014da6874870f25e52cfe452a"
        Width:  70
        Height:  39
        Gamma:  2.2
        Red:  QQuaternion(scalar:1, vector:(0.655273, 0.324219, 0))
        Green:  QQuaternion(scalar:1, vector:(0.208984, 0.713867, 0))
        Blue:  QQuaternion(scalar:1, vector:(0.146484, 0.0507813, 0))
        White:  QQuaternion(scalar:1, vector:(0.313477, 0.329102, 0))
Comment 6 Jovan Pavlovic 2025-03-31 20:40:03 UTC
(In reply to Oliver Beard from comment #2)
> Additionally, do you see this issue with the monitors positioned in the
> opposite configuration? (i.e. with your HP display on the left? Please make
> sure the command output provided is with the original display configuration
> where this problem is seen!)

Just tried moving HP omen screen view around gigabyte monitor and bug cannot be reproduced only when gigabyte is left and hp is right
Comment 7 Alyss 2025-04-07 08:02:51 UTC
I can confirm that I’m also experiencing this issue, although with a different monitor layout.

My setup consists of one large monitor on top and two smaller monitors below it. The top monitor is scaled to 110%, and the two bottom ones are scaled to 115%. When I use the rectangular region capture in Spectacle, the selection overlay appears on the wrong screen, similar to what's described.

I’ve attached a screenshot showing how it looks during the capture process.
https://postimg.cc/S2HkNgWY

Let me know if you need any additional info.
Comment 8 John Kizer 2025-04-13 05:17:29 UTC
*** Bug 500555 has been marked as a duplicate of this bug. ***
Comment 9 John Kizer 2025-04-13 05:18:19 UTC
*** Bug 502473 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2025-04-17 15:57:38 UTC
*** Bug 502909 has been marked as a duplicate of this bug. ***
Comment 11 hobs 2025-04-18 06:53:05 UTC
I have a similar issue since I upgraded from Fedora 41 to 42: https://bugs.kde.org/show_bug.cgi?id=502909

Here's my setup: https://postimg.cc/jCbSYcWs
Comment 12 Nate Graham 2025-04-18 16:56:08 UTC
*** Bug 501177 has been marked as a duplicate of this bug. ***
Comment 13 TraceyC 2025-04-18 21:03:29 UTC
I've spent a decent amount of time this afternoon trying to reproduce this, with no success so far
I've tried with two different laptops running git-master plasma - one has an AMD GPU, the other an NVIDIA

I've tried variations in 
Display positions (horizontally and vertically)
2 or 3 displays
Native vs non-native resolution
Different scale factors
Comment 14 Jovan Pavlovic 2025-04-22 17:50:40 UTC
I would be willing to try to debug this myself. 
Could you lads give me pointers on how to attach debugger on spectacle and some initial function where screen selection should start?
Comment 15 Ilia Kats 2025-04-22 20:13:34 UTC
(In reply to Jovan Pavlovic from comment #14)
> I would be willing to try to debug this myself. 
> Could you lads give me pointers on how to attach debugger on spectacle and
> some initial function where screen selection should start?

I've already done some debugging over here: https://bugs.kde.org/show_bug.cgi?id=501177#c8
Comment 16 hobs 2025-04-25 04:23:37 UTC
(In reply to hobs from comment #11)
> I have a similar issue since I upgraded from Fedora 41 to 42:
> https://bugs.kde.org/show_bug.cgi?id=502909
> 
> Here's my setup: https://postimg.cc/jCbSYcWs

https://postimg.cc/XrZ7CyH7

I tried it on my 2. desk. When I want to make a screenshot on the left top screen, the screenshot is taken on the left bottom one. Screenshotting on other screens work as expected.

Not sure how this helps, but if anyone has an idea what I can check additionally, please let me know.
Comment 17 TraceyC 2025-04-25 14:12:41 UTC
Thanks for the screen shot of your display setup. Can you attach that directly to the bug report? That way it won't be lost even if the link goes dead.
Comment 18 Jonas Ryssel 2025-04-25 20:08:01 UTC
Created attachment 180662 [details]
Display arrangement used to reproduce bug, with a marked section of where to take a screenshot.

I think I have figured out the root cause... or something close to it.

---- How to forcibly recreate the issue on any PC ----
1. Have a setup with 2 (or more) displays.
2. In the "display configuration" settings place your displays so that they are overlapping, and with one of them being larger than the other/sticking out to a side. Using display scaling to make one display much larger than the other is an easy way to make them stick out.
3. Open the rectangular region select in spectacle, and select an area which is only shown on one display (i.e. in the part that is sticking out).

I've had success based on which part of which display is sticking out, and if I select an area to the top/bottom/left/right of the inner display. So if it doesn't work, swap which display is large and which is small.
(See the attached picture, if my explanation isn't clear. The red rectangle is the area that I try to take a screenshot of.)

---- Why it happens (seemingly) randomly ----
I have a strong suspicion that sometimes KWin and Spectacle disagree on the resolution of displays when using fractional scaling.
With my setup (where the bug is present) `the display is set to 2560x2880 with 150% scaling.
If I take a full screen screenshot using the "current screen" option in spectacle, the resolution is 2561x1440.
This suggests that spectacle (or QT or something else) thinks that the display is 1 pixel wider than what KWin thinks, and if I then place that display to the left, the displays will overlap by 1 pixel, causing the issue.

---- My (unqualified) guess on what causes the issue / what to look for in the code ----
I think there are two bugs which would fix this issue, and I don't know which one is easier to fix (probably nr. 1).

1. There is a math issue somewhere in the code (duh!).
In my tests the issue only seems to be present when `resolution/scaling factor` calculation results in the fractional part being above .5 (i.e. it would be rounded up), which suggests a rounding error... I have however also found a case where the faction is above .5 and the bug isn't present, so it is only a hunch.
I guess this relates to how "weird" resolutions causes the issue. I have another PC setup where I couldn't reproduce the issue, but once I switched to a 1368x768 resolution, it became much easier to reproduce it without purposefully overlapping the displays.

2. If you have overlapping displays, Spectacle seemingly takes your mouse offset relative to the top left corner of one display, then selects an area with the same offset but relative to the other display's top left corner.

Sorry for rambling ;)
Comment 19 Jonas Ryssel 2025-04-25 20:11:33 UTC
I made a typo. The screenshot resolution was 2561x2880, not 2561x1440.

(In reply to Jonas Ryssel from comment #18)
> If I take a full screen screenshot using the "current screen" option in
> spectacle, the resolution is 2561x1440.
Comment 20 Marcin Orlowski 2025-05-14 10:39:22 UTC
Come to add "me too". I have two displays side by side (display scaling 118,75% if matters,  most likely not). When I try to take a screenshot of whole screen, it presents me panorama of boths screens shown on main display. When I select area on that "combined" screen and confirm, then it returns to normal display (every screen on its own) but **then** takes the screenshot and try to crop according to area I selected. But as it is after combined screen is gone, the offset is wrong (I got [Laptop][Display] while "Display" is my main and is huge resolution. So on "screnshot" "laptop" is inserted on the left side, and shifts the "Display" screen "laptop"'s width to the right. So final crop in my case, if target area was on "Display" is shifted by "Laptop"'s screen width.
Comment 21 Lynn T. 2025-05-16 10:06:29 UTC
I can confirm I have this issue with three 3840x2160, lined horizontally, with the middle monitor rotated 90 degrees clockwise at 150% scaling. 
The middle monitor is the only one that has problems, both unrotated monitors are able to work fine without issue. 

kscreen-console outputs
START: Requesting Config
Received config. Took 3 milliseconds
Screen:
        maxSize: QSize(64000, 64000)
        minSize: QSize(0, 0)
        currentSize: QSize(6514, 1674)

-----------------------------------------------------

Id:  1
Name:  "DP-1"
Type:  "DisplayPort"
Connected:  true
Enabled:  true
Priority:  2
Rotation:  KScreen::Output::None
Pos:  QPoint(3954,234)
MMSize:  QSize(699, 395)
FollowPreferredMode:  false
Size:  QSize(3840, 2160)
Scale:  1.5
Clones:  None
Mode:  "2"
Preferred Mode:  "1"
Preferred modes:  QList("1")
Modes: 
         "1"    "3840x2160@60"   QSize(3840, 2160)   60
         "10"    "1920x1080@240"   QSize(1920, 1080)   239.884
         "11"    "1920x1080@120"   QSize(1920, 1080)   120
         "12"    "1920x1080@120"   QSize(1920, 1080)   119.88
         "13"    "1920x1080@60"   QSize(1920, 1080)   60
         "14"    "1920x1080@60"   QSize(1920, 1080)   60
         "15"    "1920x1080@60"   QSize(1920, 1080)   59.94
         "16"    "1600x1200@60"   QSize(1600, 1200)   60
         "17"    "1680x1050@60"   QSize(1680, 1050)   59.954
         "18"    "1280x1024@75"   QSize(1280, 1024)   75.025
         "19"    "1440x900@60"   QSize(1440, 900)   59.887
         "2"    "3840x2160@240"   QSize(3840, 2160)   239.99
         "20"    "1280x960@60"   QSize(1280, 960)   60
         "21"    "1280x800@60"   QSize(1280, 800)   60
         "22"    "1152x864@75"   QSize(1152, 864)   75
         "23"    "1280x720@120"   QSize(1280, 720)   120
         "24"    "1280x720@120"   QSize(1280, 720)   119.88
         "25"    "1280x720@60"   QSize(1280, 720)   60
         "26"    "1280x720@60"   QSize(1280, 720)   60
         "27"    "1280x720@60"   QSize(1280, 720)   59.94
         "28"    "1280x720@50"   QSize(1280, 720)   50
         "29"    "1024x768@75"   QSize(1024, 768)   75.029
         "3"    "3840x2160@180"   QSize(3840, 2160)   179.999
         "30"    "1024x768@70"   QSize(1024, 768)   70.069
         "31"    "1024x768@60"   QSize(1024, 768)   60.004
         "32"    "800x600@75"   QSize(800, 600)   75
         "33"    "800x600@72"   QSize(800, 600)   72.188
         "34"    "800x600@60"   QSize(800, 600)   60.317
         "35"    "800x600@56"   QSize(800, 600)   56.25
         "36"    "640x480@75"   QSize(640, 480)   75
         "37"    "640x480@73"   QSize(640, 480)   72.809
         "38"    "640x480@67"   QSize(640, 480)   66.667
         "39"    "640x480@60"   QSize(640, 480)   60
         "4"    "3840x2160@120"   QSize(3840, 2160)   119.999
         "40"    "640x480@60"   QSize(640, 480)   59.94
         "41"    "640x480@60"   QSize(640, 480)   59.94
         "42"    "720x400@70"   QSize(720, 400)   70.082
         "43"    "1600x1200@60"   QSize(1600, 1200)   59.869
         "44"    "1280x1024@60"   QSize(1280, 1024)   59.895
         "45"    "1024x768@60"   QSize(1024, 768)   59.92
         "46"    "2560x1600@60"   QSize(2560, 1600)   59.987
         "47"    "1920x1200@60"   QSize(1920, 1200)   59.885
         "48"    "1280x800@60"   QSize(1280, 800)   59.81
         "49"    "3840x2160@60"   QSize(3840, 2160)   59.981
         "5"    "3840x2160@60"   QSize(3840, 2160)   59.94
         "50"    "3200x1800@60"   QSize(3200, 1800)   59.956
         "51"    "2880x1620@60"   QSize(2880, 1620)   59.96
         "52"    "2560x1440@60"   QSize(2560, 1440)   59.961
         "53"    "1920x1080@60"   QSize(1920, 1080)   59.963
         "54"    "1600x900@60"   QSize(1600, 900)   59.946
         "55"    "1368x768@60"   QSize(1368, 768)   59.882
         "56"    "1280x720@60"   QSize(1280, 720)   59.855
         "6"    "2560x1440@240"   QSize(2560, 1440)   239.847
         "7"    "2560x1440@120"   QSize(2560, 1440)   119.998
         "8"    "2560x1440@60"   QSize(2560, 1440)   59.951
         "9"    "1920x1200@60"   QSize(1920, 1200)   60
EDID Info: 
        Device ID:  "xrandr-Microstep-MAG321UX OLED"
        Name:  "MAG321UX OLED"
        Vendor:  "Microstep"
        Serial:  ""
        EISA ID:  ""
        Hash:  "06709fadcd3b434a9f6fc8cae331fa66"
        Width:  70
        Height:  40
        Gamma:  2.2
        Red:  QQuaternion(scalar:1, vector:(0.683594, 0.304688, 0))
        Green:  QQuaternion(scalar:1, vector:(0.244141, 0.708984, 0))
        Blue:  QQuaternion(scalar:1, vector:(0.143555, 0.0556641, 0))
        White:  QQuaternion(scalar:1, vector:(0.313477, 0.329102, 0))

-----------------------------------------------------

Id:  2
Name:  "DP-2"
Type:  "DisplayPort"
Connected:  true
Enabled:  true
Priority:  3
Rotation:  KScreen::Output::Left
Pos:  QPoint(2560,0)
MMSize:  QSize(697, 392)
FollowPreferredMode:  false
Size:  QSize(2160, 3840)
Scale:  1.55
Clones:  None
Mode:  "57"
Preferred Mode:  "57"
Preferred modes:  QList("57")
Modes: 
         "57"    "3840x2160@60"   QSize(3840, 2160)   59.997
         "58"    "3840x2160@64"   QSize(3840, 2160)   64
         "59"    "3840x2160@30"   QSize(3840, 2160)   30
         "60"    "2560x1440@60"   QSize(2560, 1440)   59.951
         "61"    "1920x1200@60"   QSize(1920, 1200)   59.997
         "62"    "1920x1080@60"   QSize(1920, 1080)   60
         "63"    "1920x1080@60"   QSize(1920, 1080)   60
         "64"    "1920x1080@60"   QSize(1920, 1080)   59.94
         "65"    "1600x1200@60"   QSize(1600, 1200)   59.997
         "66"    "1680x1050@60"   QSize(1680, 1050)   59.954
         "67"    "1280x1024@60"   QSize(1280, 1024)   60.02
         "68"    "1440x900@60"   QSize(1440, 900)   59.887
         "69"    "1280x960@60"   QSize(1280, 960)   60
         "70"    "1280x800@60"   QSize(1280, 800)   59.81
         "71"    "1280x720@60"   QSize(1280, 720)   60
         "72"    "1280x720@60"   QSize(1280, 720)   60
         "73"    "1280x720@60"   QSize(1280, 720)   59.94
         "74"    "1024x768@60"   QSize(1024, 768)   60.004
         "75"    "800x600@60"   QSize(800, 600)   60.317
         "76"    "800x600@56"   QSize(800, 600)   56.25
         "77"    "720x576@50"   QSize(720, 576)   50
         "78"    "720x480@60"   QSize(720, 480)   60
         "79"    "720x480@60"   QSize(720, 480)   59.94
         "80"    "640x480@60"   QSize(640, 480)   60
         "81"    "640x480@60"   QSize(640, 480)   59.94
         "82"    "1600x1200@60"   QSize(1600, 1200)   59.869
         "83"    "1280x1024@60"   QSize(1280, 1024)   59.895
         "84"    "1024x768@60"   QSize(1024, 768)   59.92
         "85"    "2560x1600@60"   QSize(2560, 1600)   59.987
         "86"    "1920x1200@60"   QSize(1920, 1200)   59.885
         "87"    "3840x2160@60"   QSize(3840, 2160)   59.981
         "88"    "3200x1800@60"   QSize(3200, 1800)   59.956
         "89"    "2880x1620@60"   QSize(2880, 1620)   59.96
         "90"    "2560x1440@60"   QSize(2560, 1440)   59.961
         "91"    "1920x1080@60"   QSize(1920, 1080)   59.963
         "92"    "1600x900@60"   QSize(1600, 900)   59.946
         "93"    "1368x768@60"   QSize(1368, 768)   59.882
         "94"    "1280x720@60"   QSize(1280, 720)   59.855
EDID Info: 
        Device ID:  "xrandr-Sceptre Tech Inc-Sceptre Z32"
        Name:  "Sceptre Z32"
        Vendor:  "Sceptre Tech Inc"
        Serial:  ""
        EISA ID:  ""
        Hash:  "4c553988482b109e72eb534bec5865ea"
        Width:  70
        Height:  39
        Gamma:  2.2
        Red:  QQuaternion(scalar:1, vector:(0.669922, 0.3125, 0))
        Green:  QQuaternion(scalar:1, vector:(0.327148, 0.639648, 0))
        Blue:  QQuaternion(scalar:1, vector:(0.135742, 0.0693359, 0))
        White:  QQuaternion(scalar:1, vector:(0.3125, 0.328125, 0))

-----------------------------------------------------

Id:  3
Name:  "DP-3"
Type:  "DisplayPort"
Connected:  true
Enabled:  true
Priority:  1
Rotation:  KScreen::Output::None
Pos:  QPoint(0,234)
MMSize:  QSize(708, 399)
FollowPreferredMode:  false
Size:  QSize(3840, 2160)
Scale:  1.5
Clones:  None
Mode:  "95"
Preferred Mode:  "95"
Preferred modes:  QList("95")
Modes: 
         "100"    "2560x1440@60"   QSize(2560, 1440)   59.951
         "101"    "1920x1200@61"   QSize(1920, 1200)   61
         "102"    "1920x1080@60"   QSize(1920, 1080)   60
         "103"    "1920x1080@60"   QSize(1920, 1080)   60
         "104"    "1920x1080@60"   QSize(1920, 1080)   59.94
         "105"    "1920x1080@50"   QSize(1920, 1080)   50
         "106"    "1600x1200@61"   QSize(1600, 1200)   61
         "107"    "1680x1050@60"   QSize(1680, 1050)   59.954
         "108"    "1600x900@60"   QSize(1600, 900)   60
         "109"    "1280x1024@75"   QSize(1280, 1024)   75.025
         "110"    "1280x1024@60"   QSize(1280, 1024)   60.02
         "111"    "1440x900@61"   QSize(1440, 900)   61
         "112"    "1280x800@60"   QSize(1280, 800)   59.81
         "113"    "1280x720@60"   QSize(1280, 720)   60
         "114"    "1280x720@60"   QSize(1280, 720)   60
         "115"    "1280x720@60"   QSize(1280, 720)   59.94
         "116"    "1280x720@50"   QSize(1280, 720)   50
         "117"    "1024x768@75"   QSize(1024, 768)   75.029
         "118"    "1024x768@60"   QSize(1024, 768)   60.004
         "119"    "800x600@75"   QSize(800, 600)   75
         "120"    "800x600@60"   QSize(800, 600)   60.317
         "121"    "720x576@50"   QSize(720, 576)   50
         "122"    "720x576@50"   QSize(720, 576)   50
         "123"    "720x480@60"   QSize(720, 480)   60
         "124"    "720x480@60"   QSize(720, 480)   60
         "125"    "720x480@60"   QSize(720, 480)   59.94
         "126"    "720x480@60"   QSize(720, 480)   59.94
         "127"    "720x480@60"   QSize(720, 480)   59.94
         "128"    "640x480@73"   QSize(640, 480)   72.809
         "129"    "640x480@67"   QSize(640, 480)   66.667
         "130"    "640x480@60"   QSize(640, 480)   60
         "131"    "640x480@60"   QSize(640, 480)   59.94
         "132"    "640x480@60"   QSize(640, 480)   59.94
         "133"    "720x400@70"   QSize(720, 400)   70.082
         "134"    "1600x1200@60"   QSize(1600, 1200)   59.869
         "135"    "1280x1024@60"   QSize(1280, 1024)   59.895
         "136"    "1024x768@60"   QSize(1024, 768)   59.92
         "137"    "2560x1600@60"   QSize(2560, 1600)   59.987
         "138"    "1920x1200@60"   QSize(1920, 1200)   59.885
         "139"    "3840x2160@60"   QSize(3840, 2160)   59.981
         "140"    "3200x1800@60"   QSize(3200, 1800)   59.956
         "141"    "2880x1620@60"   QSize(2880, 1620)   59.96
         "142"    "2560x1440@60"   QSize(2560, 1440)   59.961
         "143"    "1920x1080@60"   QSize(1920, 1080)   59.963
         "144"    "1600x900@60"   QSize(1600, 900)   59.946
         "145"    "1368x768@60"   QSize(1368, 768)   59.882
         "146"    "1280x720@60"   QSize(1280, 720)   59.855
         "95"    "3840x2160@61"   QSize(3840, 2160)   61
         "96"    "4096x2160@60"   QSize(4096, 2160)   60
         "97"    "4096x2160@60"   QSize(4096, 2160)   59.94
         "98"    "4096x2160@50"   QSize(4096, 2160)   50
         "99"    "3840x2160@30"   QSize(3840, 2160)   30
EDID Info: 
        Device ID:  "xrandr-UHD DP-21573"
        Name:  "UHD DP"
        Vendor:  ""
        Serial:  "21573"
        EISA ID:  ""
        Hash:  "8b2068e216244305ffd30aa0fd707486"
        Width:  70
        Height:  40
        Gamma:  2.2
        Red:  QQuaternion(scalar:1, vector:(0.657227, 0.328125, 0))
        Green:  QQuaternion(scalar:1, vector:(0.301758, 0.623047, 0))
        Blue:  QQuaternion(scalar:1, vector:(0.146484, 0.0556641, 0))
        White:  QQuaternion(scalar:1, vector:(0.3125, 0.328125, 0))

-----------------------------------------------------

Id:  4
Name:  "HDMI-A-1"
Type:  "HDMI"
Connected:  true
Enabled:  false
Priority:  0
Rotation:  KScreen::Output::None
Pos:  QPoint(4369,-846)
MMSize:  QSize(1872, 1053)
FollowPreferredMode:  false
Size:  QSize(3840, 2160)
Scale:  2
Clones:  None
Mode:  "147"
Preferred Mode:  "147"
Preferred modes:  QList("147")
Modes: 
         "147"    "3840x2160@60"   QSize(3840, 2160)   60
         "148"    "4096x2160@60"   QSize(4096, 2160)   60
         "149"    "4096x2160@60"   QSize(4096, 2160)   59.94
         "150"    "4096x2160@50"   QSize(4096, 2160)   50
         "151"    "4096x2160@24"   QSize(4096, 2160)   24
         "152"    "4096x2160@24"   QSize(4096, 2160)   23.976
         "153"    "3840x2160@60"   QSize(3840, 2160)   60
         "154"    "3840x2160@60"   QSize(3840, 2160)   59.94
         "155"    "3840x2160@50"   QSize(3840, 2160)   50
         "156"    "3840x2160@30"   QSize(3840, 2160)   30
         "157"    "3840x2160@30"   QSize(3840, 2160)   29.97
         "158"    "3840x2160@25"   QSize(3840, 2160)   25
         "159"    "3840x2160@24"   QSize(3840, 2160)   24
         "160"    "3840x2160@24"   QSize(3840, 2160)   23.976
         "161"    "1920x1200@60"   QSize(1920, 1200)   60
         "162"    "1920x1080@120"   QSize(1920, 1080)   120
         "163"    "1920x1080@120"   QSize(1920, 1080)   119.88
         "164"    "1920x1080@100"   QSize(1920, 1080)   100
         "165"    "1920x1080@60"   QSize(1920, 1080)   60
         "166"    "1920x1080@60"   QSize(1920, 1080)   60
         "167"    "1920x1080@60"   QSize(1920, 1080)   59.94
         "168"    "1920x1080@50"   QSize(1920, 1080)   50
         "169"    "1920x1080@30"   QSize(1920, 1080)   30
         "170"    "1920x1080@30"   QSize(1920, 1080)   29.97
         "171"    "1920x1080@24"   QSize(1920, 1080)   24
         "172"    "1920x1080@24"   QSize(1920, 1080)   23.976
         "173"    "1600x1200@60"   QSize(1600, 1200)   60
         "174"    "1680x1050@60"   QSize(1680, 1050)   60
         "175"    "1280x1024@60"   QSize(1280, 1024)   60.02
         "176"    "1440x900@60"   QSize(1440, 900)   59.901
         "177"    "1280x800@60"   QSize(1280, 800)   60
         "178"    "1280x720@60"   QSize(1280, 720)   60
         "179"    "1280x720@60"   QSize(1280, 720)   59.94
         "180"    "1280x720@50"   QSize(1280, 720)   50
         "181"    "1024x768@60"   QSize(1024, 768)   60.004
         "182"    "800x600@60"   QSize(800, 600)   60.317
         "183"    "720x576@50"   QSize(720, 576)   50
         "184"    "720x480@60"   QSize(720, 480)   60
         "185"    "720x480@60"   QSize(720, 480)   60
         "186"    "720x480@60"   QSize(720, 480)   59.94
         "187"    "720x480@60"   QSize(720, 480)   59.94
         "188"    "640x480@60"   QSize(640, 480)   60
         "189"    "640x480@60"   QSize(640, 480)   59.94
         "190"    "640x480@60"   QSize(640, 480)   59.94
         "191"    "1600x1200@60"   QSize(1600, 1200)   59.869
         "192"    "1280x1024@60"   QSize(1280, 1024)   59.895
         "193"    "1024x768@60"   QSize(1024, 768)   59.92
         "194"    "2560x1600@60"   QSize(2560, 1600)   59.987
         "195"    "1920x1200@60"   QSize(1920, 1200)   59.885
         "196"    "1280x800@60"   QSize(1280, 800)   59.81
         "197"    "3840x2160@60"   QSize(3840, 2160)   59.981
         "198"    "3200x1800@60"   QSize(3200, 1800)   59.956
         "199"    "2880x1620@60"   QSize(2880, 1620)   59.96
         "200"    "2560x1440@60"   QSize(2560, 1440)   59.961
         "201"    "1920x1080@60"   QSize(1920, 1080)   59.963
         "202"    "1600x900@60"   QSize(1600, 900)   59.946
         "203"    "1368x768@60"   QSize(1368, 768)   59.882
         "204"    "1280x720@60"   QSize(1280, 720)   59.855
EDID Info: 
        Device ID:  "xrandr-Mega System Technologies Inc-MEC-O-3-H-1"
        Name:  "MEC-O-3-H"
        Vendor:  "Mega System Technologies Inc"
        Serial:  "1"
        EISA ID:  ""
        Hash:  "651e568269c5e114f7e5d6bcce53333a"
        Width:  115
        Height:  65
        Gamma:  2.2
        Red:  QQuaternion(scalar:1, vector:(0.639648, 0.339844, 0))
        Green:  QQuaternion(scalar:1, vector:(0.299805, 0.69043, 0))
        Blue:  QQuaternion(scalar:1, vector:(0.137695, 0.0380859, 0))
        White:  QQuaternion(scalar:1, vector:(0.282227, 0.296875, 0))
Comment 22 John Kizer 2025-05-16 15:22:08 UTC
I can't personally reproduce, but marking as "confirmed" based on the number of different reports detailing this issue. Thanks!
Comment 23 Kamen 2025-05-22 06:30:06 UTC
I also can reproduce this - I have three screens - two with the same resolution (2560x1440) and scaling 150%, and a laptop screen in the middle (2256x1504) with 175% scaling. One additional detail - the two external screens are daisy-chained and one of them is always projected on one of the other two, depending on how they are ordered.
Comment 24 Kamen 2025-05-22 06:34:17 UTC
(In reply to Kamen from comment #23)
> I also can reproduce this - I have three screens - two with the same
> resolution (2560x1440) and scaling 150%, and a laptop screen in the middle
> (2256x1504) with 175% scaling. One additional detail - the two external
> screens are daisy-chained and one of them is always projected on one of the
> other two, depending on how they are ordered.

With some more testing - seems it is always the second one in the daisy-chain that can't be region selected.
Comment 25 Noah Davis 2025-05-23 08:36:58 UTC
I can't reproduce the original video showcase with two screens horizontally next to each other, but I can reproduce the screenshot showcase with two screens centered at the middle.
Comment 26 Noah Davis 2025-05-23 08:59:06 UTC
(In reply to Jonas Ryssel from comment #18)
> I have a strong suspicion that sometimes KWin and Spectacle disagree on the
> resolution of displays when using fractional scaling.

That could be the case. I was recently told by KWin a developer that it's actually impossible to properly get the device pixel ratio on Wayland using Qt or KDE APIs. Most of the time QScreen::devicePixelRatio is good enough, but there are edge cases.

> With my setup (where the bug is present) `the display is set to 2560x2880
> with 150% scaling.
> If I take a full screen screenshot using the "current screen" option in
> spectacle, the resolution is 2561x1440.
> This suggests that spectacle (or QT or something else) thinks that the
> display is 1 pixel wider than what KWin thinks, and if I then place that
> display to the left, the displays will overlap by 1 pixel, causing the issue.

The screenshot for this case actually comes directly from KWin's screenshot plugin without modification, so I'm not totally sure what's going on there. I think 2560 is likely being divided by 1.5 somewhere (1706.67) and rounded (1707), then multiplied by 1.5 by Spectacle (2560.5) and rounded again (2561). Unfortunately there's not a lot that can be done about that since screen and window sizes are defined in logical coordinates (physical pixel size divided by DPR) as integers. Qt's QScreen and QWindow classes use integers for sizes and positions, but Wayland itself even uses integers for sizes and positions in logical coordinates. This means some precision is guaranteed to be lost.

> ---- My (unqualified) guess on what causes the issue / what to look for in
> the code ----
> I think there are two bugs which would fix this issue, and I don't know
> which one is easier to fix (probably nr. 1).
> 
> 1. There is a math issue somewhere in the code (duh!).
> In my tests the issue only seems to be present when `resolution/scaling
> factor` calculation results in the fractional part being above .5 (i.e. it
> would be rounded up), which suggests a rounding error... I have however also
> found a case where the faction is above .5 and the bug isn't present, so it
> is only a hunch.
> I guess this relates to how "weird" resolutions causes the issue. I have
> another PC setup where I couldn't reproduce the issue, but once I switched
> to a 1368x768 resolution, it became much easier to reproduce it without
> purposefully overlapping the displays.
> 
> 2. If you have overlapping displays, Spectacle seemingly takes your mouse
> offset relative to the top left corner of one display, then selects an area
> with the same offset but relative to the other display's top left corner.
> 
> Sorry for rambling ;)

Number 2 is probably what I'll end up having to do. I don't mind ramblers who are helping :)
Comment 27 Noah Davis 2025-05-23 10:51:09 UTC
It turns out this is a lot more complicated and depends on more parts outside of Spectacle than I thought. I get a feeling this won't be fixed in time for 6.4 unless a lot of special effort is made at different levels of the stack.
Comment 28 Marcin Orlowski 2025-05-23 16:35:14 UTC
Which is a good opportunity to introduce some basic editing tools to Spectacle, like crop :)
Comment 29 Nate Graham 2025-05-23 17:02:56 UTC
Jonas, your issue involves overlapping screens, unlike most other people encountering the bug. This makes it something different, which would need a separate bug report.

However overlapping screens like that are not really supported; I'd strongly recommend using a different arrangement, as you'll find a million weird random-feeling bugs everywhere. Also, in a future Plasma version, arrangements like this will be disallowed.
Comment 30 Nate Graham 2025-05-23 17:04:26 UTC
For people who have been able to reproduce this issue (the original issue, not the new one reported by Jonas which involves overlapping screens), are you still seeing it happen with Qt 6.9? We're having a great deal of trouble reproducing it on our Qt 6.9 dev systems, and suspect it may already be fixed.

If anyone can still reproduce this issue in Qt 6.9, please let us know. Thanks a lot, folks!
Comment 31 Jonas Ryssel 2025-05-23 17:31:51 UTC
(In reply to Noah Davis from comment #26)
> The screenshot for this case actually comes directly from KWin's screenshot plugin
> without modification, so I'm not totally sure what's going on there. I think 2560 is
> likely being divided by 1.5 somewhere (1706.67) and rounded (1707), then multiplied
> by 1.5 by Spectacle (2560.5) and rounded again (2561). Unfortunately there's not a
> lot that can be done about that since screen and window sizes are defined in logical
> coordinates (physical pixel size divided by DPR) as integers. Qt's QScreen and
> QWindow classes use integers for sizes and positions, but Wayland itself even uses
> integers for sizes and positions in logical coordinates. This means some precision is
> guaranteed to be lost.

It doesn't seem like you can solve the issue by fixing the math, but just to prevent double work/research:
I already tried reproducing the bug on various scaling factors, writing down which caused the issue, then trying to recreate the formula using all combinations of ceil, floor, round, *2, /2, /scaling_factor up to a depth of five (e.g. `floor(round((width*2)/scaling_factor)/2)`).
I wasn't able to make a formula with a +1 pixel error on exactly all the monitor resolutions and scaling factors where the issue occurs. So I think the formula might be way more complicated that just rounding once or twice.

(In reply to Nate Graham from comment #29)
> Jonas, your issue involves overlapping screens, unlike most other people
> encountering the bug. This makes it something different, which would need a
> separate bug report.

Just to clarify: My day-to-day monitor setup doesn't (purposefully) include overlapping monitors. I simply observed that the screenshot of my leftmost monitor was 1 pixel wider that what the resolution of the monitor supposedly was, which could potentially point at the monitors somehow accidentally overlapping by one pixel.
Since most of you had issues reproducing the bug, purposefully overlapping the monitors was only to see if I could forcefully reproduce with any setup and if it would act in the same way as the bug this issue is tackling (which could also be useful for testing a fix). The fact that it does, suggests that my theory of the monitors overlapping with one pixel is correct.
Comment 32 Jonas Ryssel 2025-05-23 17:43:53 UTC
(In reply to Nate Graham from comment #30)
> If anyone can still reproduce this issue in Qt 6.9, please let us know.

Under the assumption that my issue is indeed the same as everyone else, I still have the issue on
KDE Plasma 6.3.5
KDE Frameworks 6.14.0
Qt 6.9.0.

If you think that my issue is still a different bug, even after reading what I wrote in comment #31 (i.e. that my monitors are not actually overlapping. The output of `kscreen-doctor -o` is
Left monitor:            Geometry: 0,0 1707x1920
Right monitor:         Geometry: 1707,341 2560x1440
) , then I'll create a new bug. I just think you misunderstood what I meant.
Comment 33 Nate Graham 2025-05-23 20:36:17 UTC
Ok yeah, sounds like it. Re-opening.
Comment 34 madness742 2025-05-24 10:59:23 UTC
(In reply to Nate Graham from comment #30)
> If anyone can still reproduce this issue in Qt 6.9, please let us know.
> Thanks a lot, folks!

I can still reproduce it using the steps in Bug 500555. It is highly resolution specific and placement of the monitor makes a difference too.

Operating System: Fedora Linux 42
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0
Comment 35 Bug Janitor Service 2025-05-29 18:54:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/spectacle/-/merge_requests/459
Comment 36 Noah Davis 2025-05-30 19:13:29 UTC
Git commit f407154111eb6fd3f8c0cc3d80eb3e6c0a241be7 by Noah Davis.
Committed on 30/05/2025 at 02:49.
Pushed by ndavis into branch 'master'.

Workaround QWindow::screen being wrong with some fractional DPR screen layout combinations

Caused the selection editor to select on the wrong screen.

M  +5    -0    src/Gui/CaptureWindow.cpp

https://invent.kde.org/graphics/spectacle/-/commit/f407154111eb6fd3f8c0cc3d80eb3e6c0a241be7
Comment 37 Noah Davis 2025-05-30 19:14:00 UTC
Git commit 64e46b80e621e48f6e7fc9eff555c320d327457b by Noah Davis.
Committed on 30/05/2025 at 19:13.
Pushed by ndavis into branch 'Plasma/6.4'.

Workaround QWindow::screen being wrong with some fractional DPR screen layout combinations

Caused the selection editor to select on the wrong screen.


(cherry picked from commit f407154111eb6fd3f8c0cc3d80eb3e6c0a241be7)

Co-authored-by: Noah Davis <noahadvs@gmail.com>

M  +5    -0    src/Gui/CaptureWindow.cpp

https://invent.kde.org/graphics/spectacle/-/commit/64e46b80e621e48f6e7fc9eff555c320d327457b
Comment 38 Jonas Ryssel 2025-06-01 10:51:31 UTC
(In reply to Noah Davis from comment #37)
> Git commit 64e46b80e621e48f6e7fc9eff555c320d327457b by Noah Davis.
> Committed on 30/05/2025 at 19:13.
> Pushed by ndavis into branch 'Plasma/6.4'.

I just compiled it and can confirm that the bug has been fixed.
A huge thank you from me <3
Comment 39 Lynn T. 2025-06-03 10:58:57 UTC Comment hidden (spam)
Comment 40 Nate Graham 2025-06-03 11:57:20 UTC Comment hidden (spam)
Comment 41 Nate Graham 2025-06-13 14:50:11 UTC
*** Bug 505548 has been marked as a duplicate of this bug. ***
Comment 42 Jovan Pavlovic 2025-06-20 19:07:57 UTC
Just to confirm new 6.4 spectacle release on arch solved issue for me.
Thanks everyone