Bug 443698 - Windows do not follow screens when changing screen positions
Summary: Windows do not follow screens when changing screen positions
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: 5.22.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-14 07:44 UTC by K Freed
Modified: 2022-04-19 10:53 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This is how I set my displays before changing them (to reveal the bug) (402.44 KB, image/png)
2021-10-14 07:44 UTC, K Freed
Details
This is what happens when I change the screen positions (Observed behavior/Bug) (775.50 KB, image/png)
2021-10-14 07:46 UTC, K Freed
Details
This is what should happen when changing screen positions (Expected behavior) (401.73 KB, image/png)
2021-10-14 07:47 UTC, K Freed
Details
Screenshot with one screen configuration (400.94 KB, image/png)
2021-10-31 23:27 UTC, Andreas Hartmetz
Details
The configuration with two screens, before pressing Apply in System Settings (88.26 KB, image/png)
2021-10-31 23:28 UTC, Andreas Hartmetz
Details
What it looked like after applying the new configuration (3.54 MB, image/png)
2021-10-31 23:28 UTC, Andreas Hartmetz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description K Freed 2021-10-14 07:44:38 UTC
Created attachment 142422 [details]
This is how I set my displays before changing them (to reveal the bug)

SUMMARY
When switching screen positioning in the display configuration settings, windows do not follow, resulting in very weird window placement. Check the attachments for more clarity.

STEPS TO REPRODUCE
1. Set display configuration screen positions
2. Move windows to desired screens
3. Change display configuration screen positions

OBSERVED RESULT
Windows do not follow screen position changes (image attached)

EXPECTED RESULT
Windows follow screen position changes (image attached)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kernel 5.10, Arch linux (EndeavourOS)
(available in About System)
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

Primary Screen: Laptop Screen (1366x768)
Graphics card: Intel UHD620 using the i915 video driver
Connection method: Built-in HDMI port
Screen resolution(s): 1366x758(Laptop) 1920x1080 (external monitor 1) 3840x2160 (external monitor 2)
Replica of: None
Bug screenshot is attached. Top bar represents laptop screen edge
Comment 1 K Freed 2021-10-14 07:46:16 UTC
Created attachment 142423 [details]
This is what happens when I change the screen positions (Observed behavior/Bug)
Comment 2 K Freed 2021-10-14 07:47:29 UTC
Created attachment 142424 [details]
This is what should happen when changing screen positions (Expected behavior)
Comment 3 Vlad Zahorodnii 2021-10-30 14:03:13 UTC
Git commit 4928f4db5b810969c70d549729c23ff95d1a6781 by Vlad Zahorodnii.
Committed on 30/10/2021 at 14:02.
Pushed by vladz into branch 'master'.

Try to preserve window position relative to their outputs during hotplug

Currently, if an output is hotplugged, all windows will be scrambled,
which is highly annoying.

With this change, windows will stick to their outputs if an output has
been connected or disconnected.
Related: bug 296673, bug 378896, bug 412703

M  +10   -12   src/abstract_client.cpp

https://invent.kde.org/plasma/kwin/commit/4928f4db5b810969c70d549729c23ff95d1a6781
Comment 4 Andreas Hartmetz 2021-10-31 23:26:15 UTC
Ah, it is very nice that someone is taking care of it, thank you. But it doesn't work quite right yet.
I have a 1920x1200 primary screen and I sometimes activate a 1920x1080 projector, placed logically above the primary screen because the images is in fact physically above. So far, I worked around the bug reported here by placing the projector logically to the right. I saw the fixes land and tried it again. The existing windows did stay on the right screen, but their height was reduced to almost nothing.

I have Qt 5.15 compiled from branch "kde/5.15" and KDE everything master, compiled late on 2021-10-30 / early on 2021-10-31.

Attachments:
- before-one-screen.png: Screenshot with one screen configuration
- two_screen_config_before_apply.png: The configuration with two screens, before pressing Apply in System Settings
- after-two-screens.png: What it looked like after applying the new configuration

What I wanted is that windows don't change size and stay in the exact same (physical) position on the same (physical) screen. Basically the first screenshot plus an empty second screen. It is possible that some remembered window positions for an earlier two-screen configuration are messing up the result.
Comment 5 Andreas Hartmetz 2021-10-31 23:27:23 UTC
Created attachment 143068 [details]
Screenshot with one screen configuration
Comment 6 Andreas Hartmetz 2021-10-31 23:28:12 UTC
Created attachment 143069 [details]
The configuration with two screens, before pressing Apply in System Settings
Comment 7 Andreas Hartmetz 2021-10-31 23:28:45 UTC
Created attachment 143070 [details]
What it looked like after applying the new configuration
Comment 8 Andreas Hartmetz 2021-10-31 23:39:17 UTC
(In reply to Andreas Hartmetz from comment #4)

s/did stay on the right screen/did stay on the correct screen/

Further information: I am using Kubuntu 21.10 and X11 (Qt and KDE compiled from sources as stated), also most of x.org code I am using (most libraries, notably mesa) is self compiled, but not the Xorg server which is from /usr/lib/xorg/Xorg.
Comment 9 K Freed 2022-04-12 16:14:08 UTC
Have you tried this out recently? I haven't run into any issues with this? If it works now, we should close this
Comment 10 Andreas Hartmetz 2022-04-13 18:11:17 UTC
Actually, I have big trouble with session restore since maybe four weeks ago. Sort of randomly, after session restore application windows do not materialize on the screen or in any taskbar (even thought the processes are running), and usually plasmashell needs a restart or two to appear in the correct size or at all It's getting hard to tell apart what exactly is which problem. Application windows that can be hidden and restored from tray *can* be restored from tray every time.
Can you keep this open for a bit until I have investigated that or the bug gets too old? FWIW, the problem might be triggered by having the projector connected but disabled at startup. (But the applications do not seem to appear on the projector, "show applications from all windows" in the taskbar settings does nothing, enabling and disabling the projector also does not make any windows appear.)
Comment 11 Andreas Hartmetz 2022-04-19 10:53:01 UTC
This one is fixed here as well, thanks!
Other problems have become much less severe after cleaning up my install directory and rebuilding the KDE stack. (Session restore mostly works, except for size / positioning being off in some applications - notably Kate - after restore.)
That other stuff is mostly quite unrelated anyway, but I was very tired when I wrote the last comment, and I wanted time to think about it properly.