Bug 374498 - Windows get moved to second monitor when the latter is connected
Summary: Windows get moved to second monitor when the latter is connected
Status: RESOLVED DUPLICATE of bug 296673
Alias: None
Product: kwin
Classification: Plasma
Component: xrandr (show other bugs)
Version: 5.8.2
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-03 15:16 UTC by Rainer Klute
Modified: 2017-01-05 20:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Klute 2017-01-03 15:16:43 UTC
I am working with a notebook and about half of the time connect a second monitor. That monitor is "above" the laptop's monitor. However, whenever I connect the second monitor, most windows get moved to the external monitor. Windows that are to large for the second monitor get resized to fit on the second monitor.

This is contrary to the way I want to work. I would like to keep everything on my laptop monitor as it is, but use the second monitor only as an additional "real estate". On the second monitor, I would like to have only those windows I explicitly moved there.

Aside: Before I upgraded to KDE 5 on openSUSE 42.2 and experienced the above behavior, I used KDE 4 on openSUSE 13.2 and had the second monitor configured as being "right" from the laptop monitor, because KDE 4 couldn't store the position correctly. However, the windows correctly always remained where they were.
Comment 1 Christoph Feck 2017-01-04 18:53:01 UTC
Did you configure the laptop monitor as the primary monitor?
Comment 2 Rainer Klute 2017-01-04 18:59:48 UTC
(In reply to Christoph Feck from comment #1)
> Did you configure the laptop monitor as the primary monitor?

Yes, I did.
Comment 3 Martin Flöser 2017-01-05 20:28:49 UTC
The behavior you are experiencing is kind of expected.

To explain: the windows are positioned on a virtual screen. The actual outputs are overlapped to the virtual screen. The windows have their position in a virtual screen coordinates, they are not bound to an actual output. Consider you have a window at 0/0. When you attach a new output above your existing output what happens is the virtual screen gets resized, your windows keep the positions they have relative to the virtual screen. But the outputs changed. The position at 0/0 is now covered by the new output. It looks like all windows moved to the new output, but in truth the windows did not move at all.

The situation is difficult to handle for a window manager. X11 does not give us the information to which output a window belongs. Some windows adjust themselves (e.g. Plasma), some windows just close and get recreated (Qt 5 did so at some time). So KWin cannot know what to do in this situation. Should it move the windows or not? What if it moves one which adjusted itself?

Overall a non fixable situation on X11 and even on Wayland it will be tricky as we kind of follow the X11 approach due to the legacy debt of KWin.
Comment 4 Martin Flöser 2017-01-05 20:30:13 UTC

*** This bug has been marked as a duplicate of bug 296673 ***