Bug 505060 - Removing multiple screens lead to inaccessible windows
Summary: Removing multiple screens lead to inaccessible windows
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (other bugs)
Version First Reported In: 6.3.91
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-31 13:40 UTC by Martin Bednar
Modified: 2025-06-03 12:40 UTC (History)
2 users (show)

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


Attachments
present windows screenshot - bottom four firefox windows are "off screen" (1.07 MB, image/png)
2025-05-31 13:40 UTC, Martin Bednar
Details
kscreen-doctor -o with 2 displays attached (5.19 KB, application/octet-stream)
2025-06-02 15:32 UTC, Martin Bednar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Bednar 2025-05-31 13:40:40 UTC
Created attachment 181932 [details]
present windows screenshot - bottom four firefox windows are "off screen"

I have a laptop which I connect to 2 external screens, and disable the builtin screen (running in clamshell mode). When disconnecting, I disconnect them both in quick succession, ie the 2nd gets disconnected before the changes from disconnecting the 1st settle.
What this leads to is random windows being inaccessible when everything settles down.
Clicking on the task manager doesn't cycle through them, they appear in present windows, but the content thumbnail is wrongly sized to the window size.
Selecting "move" on the taskbar moves the cursor to the edge of the screen, but there is nothing to move.
I haven't found a way to make the windows accessible without changing the screen configuration again.

STEPS TO REPRODUCE
1. connect 2 external screens, disable builtin screen
2. open a lot of windows, place them all over 
3. quickly disconnect the 2 external screens, letting  the builtin screen enable itself

OBSERVED RESULT
when everything settles down, usually at least one window is inaccessible (I believe it is located "off screen")


EXPECTED RESULT
All windows placed on single enabled screen

Operating System: Gentoo 2.17
KDE Plasma Version: 6.3.91
KDE Frameworks Version: 6.14.0
Qt Version: 6.8.3
Kernel Version: 6.14.7-gentoo-dist-hardened (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen AI 9 HX 370 w/ Radeon 890M
Memory: 64 GiB of RAM (62.1 GiB usable)
Graphics Processor: AMD Radeon Graphics
Manufacturer: Framework
Product Name: Laptop 13 (AMD Ryzen AI 300 Series)
System Version: A9
Comment 1 Zamundaaa 2025-06-02 15:24:00 UTC
Please attach the output of kscreen-doctor with the two displays connected.
Comment 2 Martin Bednar 2025-06-02 15:32:45 UTC
Created attachment 181968 [details]
kscreen-doctor -o with 2 displays attached
Comment 3 Bug Janitor Service 2025-06-02 22:31:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7713
Comment 4 Zamundaaa 2025-06-03 11:41:52 UTC
Git commit 8424bf88b67800c3d22384022e60c08d26e50ea4 by Xaver Hugl.
Committed on 03/06/2025 at 11:10.
Pushed by zamundaaa into branch 'master'.

scene/item: restrict frame callbacks based on the output rather than geometry

Sending frame callbacks based on whether or not the bounding rect intersects with the
rendered output has two big problems:
- when a window is entirely off-screen, it never gets frame callbacks. This is particularly
  problematic when the application waits for frame callbacks to render the next frame, but
  KWin waits with moving them to an output until the application commits the surface
- when a window is on two outputs at once (like with cloning), then it gets twice the
  amount of frame callbacks - which means the application ends up rendering twice as
  fast, which doesn't make any sense

This commit replaces that approach with just checking if the output is the same as the one
Workspace picks for the center of the window. If the window is entirely off-screen, that
will still result in an output getting chosen, and it also can't be on two outputs at once.
Related: bug 479694, bug 498628

M  +2    -1    src/scene/item.cpp
M  +2    -3    src/scene/item.h
M  +9    -0    src/scene/rootitem.cpp
M  +2    -0    src/scene/rootitem.h

https://invent.kde.org/plasma/kwin/-/commit/8424bf88b67800c3d22384022e60c08d26e50ea4
Comment 5 Zamundaaa 2025-06-03 12:36:00 UTC
Git commit ada3f238db01027b7100afe60868f75b64828018 by Xaver Hugl.
Committed on 03/06/2025 at 12:04.
Pushed by zamundaaa into branch 'Plasma/6.4'.

scene/item: restrict frame callbacks based on the output rather than geometry

Sending frame callbacks based on whether or not the bounding rect intersects with the
rendered output has two big problems:
- when a window is entirely off-screen, it never gets frame callbacks. This is particularly
  problematic when the application waits for frame callbacks to render the next frame, but
  KWin waits with moving them to an output until the application commits the surface
- when a window is on two outputs at once (like with cloning), then it gets twice the
  amount of frame callbacks - which means the application ends up rendering twice as
  fast, which doesn't make any sense

This commit replaces that approach with just checking if the output is the same as the one
Workspace picks for the center of the window. If the window is entirely off-screen, that
will still result in an output getting chosen, and it also can't be on two outputs at once.
Related: bug 479694, bug 498628
(cherry picked from commit 8424bf88b67800c3d22384022e60c08d26e50ea4)

M  +2    -1    src/scene/item.cpp
M  +2    -3    src/scene/item.h
M  +9    -0    src/scene/rootitem.cpp
M  +2    -0    src/scene/rootitem.h

https://invent.kde.org/plasma/kwin/-/commit/ada3f238db01027b7100afe60868f75b64828018
Comment 6 Zamundaaa 2025-06-03 12:40:13 UTC
Git commit dc3f798e74b5b049c1506246fa37e2751052565c by Xaver Hugl.
Committed on 03/06/2025 at 12:08.
Pushed by zamundaaa into branch 'Plasma/6.3'.

scene/workspacescene: restrict frame callbacks based on the output rather than geometry

Sending frame callbacks based on whether or not the bounding rect intersects with the
rendered output has two big problems:
- when a window is entirely off-screen, it never gets frame callbacks. This is particularly
  problematic when the application waits for frame callbacks to render the next frame, but
  KWin waits with moving them to an output until the application commits the surface
- when a window is on two outputs at once (like with cloning), then it gets twice the
  amount of frame callbacks - which means the application ends up rendering twice as
  fast, which doesn't make any sense

This commit replaces that approach with just checking if the output is the same as the one
Workspace picks for the center of the window. If the window is entirely off-screen, that
will still result in an output getting chosen, and it also can't be on two outputs at once.
Related: bug 479694, bug 498628
(cherry picked from commit 8424bf88b67800c3d22384022e60c08d26e50ea4)

M  +1    -1    src/scene/workspacescene.cpp

https://invent.kde.org/plasma/kwin/-/commit/dc3f798e74b5b049c1506246fa37e2751052565c