Bug 456453 - When using Qt scaling on X11, windows in the 2nd screen are placed outside visible area when a panel is placed between screens
Summary: When using Qt scaling on X11, windows in the 2nd screen are placed outside vi...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Panel (show other bugs)
Version: 5.25.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: multiscreen
: 471480 (view as bug list)
Depends on:
Blocks: 356446
  Show dependency treegraph
 
Reported: 2022-07-07 15:06 UTC by CUI Hao
Modified: 2023-09-07 01:03 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27.8


Attachments
Screen recording that illustrates the bug (3.64 MB, video/mp4)
2022-07-07 15:06 UTC, CUI Hao
Details

Note You need to log in before you can comment on or make changes to this bug.
Description CUI Hao 2022-07-07 15:06:58 UTC
Created attachment 150470 [details]
Screen recording that illustrates the bug

SUMMARY

Please see the attached video.

When using Xorg + dual-screen (4K & 200% scale) + PLASMA_USE_QT_SCALING=1, if I place a plasma panel to between the two screens (or exactly, the left edge of the right screen), the right screen become unusable and all windows placed on it will be immediately kicked to the right edge of the screen (outside the visible area). It's still possible to pull a window out but only moving it to the left screen can prevent it from being misplaced again.

STEPS TO REPRODUCE
1. Create a fresh new user. Setup a plasma panel.
2. Move the panel to the left edge of the right screen of two screens placed horizontally.
3. Move or start a window on the right screen.

OBSERVED RESULT

All windows on the right screen are misplaced outside visible area (to the right of the right edge of the right screen).

EXPECTED RESULT

Windows are correctly placed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux with latest packages
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION

The left screen is connected to Intel iGPU (i7-10700K).
The right is connected to NVIDIA GTX 1650 GPU, which is also the primary GPU.
Setting Intel as the primary GPU makes no change.

Why am I placing the panel between two screens: I've never intended to do this. But another heisenbug which appears after 5.25 causes my panel to be moved from normal place (leftmost edge) to the wrong place (left edge of the right screen) from time to time after I unlock the screen. And whenever that happens, kwin becomes buggy in the way I said above.

About PLASMA_USE_QT_SCALING: I hadn't set the environment variable before 5.25. After 5.25 I noticed everything (icon/text/button) related to plasmashell became smaller than 5.24. Someone told me the environment variable should be set to make plasmashell use the same scale as Qt. They said it's not new in 5.25 and I should have had it set before if I didn't see inconsistent scaling before 5.25. But the thing was I never set it before 5.25.
Comment 1 Nate Graham 2022-07-13 19:04:08 UTC
Pretty sure this'll be fixed by the fix for Bug 450443.

*** This bug has been marked as a duplicate of bug 450443 ***
Comment 2 CUI Hao 2022-07-13 23:25:59 UTC
(In reply to Nate Graham from comment #1)
> Pretty sure this'll be fixed by the fix for Bug 450443.
> 
> *** This bug has been marked as a duplicate of bug 450443 ***

But it seems all the patches in bug 450443 had been applied when I reported this issue. Now I'm still observing the same issue.

Currently the following Arch Linux packages are installed on my machine:
- plasma-desktop 5.25.3
- qt5-base 5.15.5+kde+r170-1 (which is compiled from https://invent.kde.org/qt/qt/qtbase/-/commit/aa0c6db334cf6f0887f42cbd82e4af258126bdc5).
Comment 3 Nate Graham 2022-07-14 14:18:06 UTC
Hmm, OK. I guess not then.

Marking as RESOLVED INTENTIONAL for now since PLASMA_USE_QT_SCALING is not supported. Should we decide to change that (see Bug 356446), this bug report will be re-opened and investigated.

Thanks!
Comment 4 Nate Graham 2023-06-22 12:27:18 UTC
Re-opening since this will become an issue again on Plasma 6 where we're using Qt scaling by default. CUI, are you still experiencing it in Plasma 5.27.5? Maybe it's already been fixed.
Comment 5 Fushan Wen 2023-08-19 03:04:36 UTC
*** Bug 471480 has been marked as a duplicate of this bug. ***
Comment 6 Bug Janitor Service 2023-08-19 13:18:01 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwindowsystem/-/merge_requests/113
Comment 7 Fushan Wen 2023-08-30 13:03:10 UTC
Can anyone test https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3199 to see if the bug is fixed?
Comment 8 Fushan Wen 2023-09-04 16:53:29 UTC
Git commit b59a81959e9488fe656e2e54c8a410be4641c401 by Fushan Wen.
Committed on 04/09/2023 at 18:42.
Pushed by fusionfuture into branch 'master'.

KX11Extras: switch to qreal arguments in setExtendStrut/setStrut

This avoids loosing precision when setting struts.

M  +28   -28   src/kx11extras.cpp
M  +13   -13   src/kx11extras.h

https://invent.kde.org/frameworks/kwindowsystem/-/commit/b59a81959e9488fe656e2e54c8a410be4641c401
Comment 9 Fushan Wen 2023-09-07 00:33:54 UTC
Git commit 81e4140657b9dee49d98d885f865f72561b7bfe0 by Fushan Wen.
Committed on 07/09/2023 at 02:22.
Pushed by fusionfuture into branch 'master'.

PanelView: fix panel overlapping windows when Qt scaling is enabled

KX11Extras::setExtendedStrut(...) will multiply struct.* by DPR, so
passing raw coordinates to a struct is wrong. Sizes are already divided
by DPR on X11.
FIXED-IN: 5.27.8

M  +57   -42   shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/81e4140657b9dee49d98d885f865f72561b7bfe0
Comment 10 Fushan Wen 2023-09-07 01:03:41 UTC
Git commit 61bc13fcc05af721ccc5303ffd99c1882d65a7ca by Fushan Wen.
Committed on 07/09/2023 at 03:03.
Pushed by fusionfuture into branch 'Plasma/5.27'.

🍒PanelView: fix panel overlapping windows when Qt scaling is enabled

KX11Extras::setExtendedStrut(...) will multiply struct.* by DPR, so
passing raw coordinates to a struct is wrong. Sizes are already divided
by DPR on X11.
FIXED-IN: 5.27.8

(cherry picked from commit 81e4140657b9dee49d98d885f865f72561b7bfe0)

M  +35   -22   shell/panelview.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/61bc13fcc05af721ccc5303ffd99c1882d65a7ca