Bug 442953 - Bad window placement, geometry not restored
Summary: Bad window placement, geometry not restored
Status: REOPENED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: 5.21.5
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen
Depends on:
Blocks:
 
Reported: 2021-09-25 21:45 UTC by Torsten Römer
Modified: 2024-07-29 21:58 UTC (History)
2 users (show)

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


Attachments
Bad window placement and geometry not restored (1.36 MB, image/png)
2021-09-25 21:45 UTC, Torsten Römer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Torsten Römer 2021-09-25 21:45:48 UTC
Created attachment 141912 [details]
Bad window placement and geometry not restored

SUMMARY
When a second screen is connected, window placement is bad and geometry is not restored, with default settings in "Window Management" -> "Window Behavior" -> "Advanced".

STEPS TO REPRODUCE
1. Connect a second screen to a laptop
2. Laptop to the left of the external screen, external screen primary display
3. Open apps like Dolphin

OBSERVED RESULT
* App window is placed on laptop screen
* For apps like Dolphin, Kate, Konsole etc., geometry is not restored, it seems to be some internal default instead. Sometimes however, app windows are placed on the external screen.
So, almost always after opening an app, it needs to be moved to the external screen/primary display, and the geometry needs to be adjusted manually.

EXPECTED RESULT
* App is placed on the external screen since it is the primary display. Also the mouse is located on the external screen, and the external screen is empty has a larger resolution than the laptop screen.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Ubuntu 21.04/5.21.4
(available in About System)
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
After changing settings in "Window Management" -> "Window Behavior" -> "Advanced", the whole system becomes very laggy and logging off and in again is necessary to fix this.
Comment 1 Torsten Römer 2021-09-25 21:50:32 UTC
I probably should add than when no external screen is connected, window positions and geometry are restored correctly.
Comment 2 Nate Graham 2021-09-27 19:53:58 UTC

*** This bug has been marked as a duplicate of bug 378896 ***
Comment 3 Méven Car 2021-10-25 09:03:20 UTC
This is not an exact duplicate of https://bugs.kde.org/show_bug.cgi?id=378896.

This concerns window restore state saving done by KConfig.

However it seems to point errors toward Qt at least 5.12 in K(Ubuntu), distros using the KDE Qt Patch collection may not be concerned.

I noticed QWindow reporting wrong screen for windows.
Here I have two screens, a 2560x1440 on the left and a smaller laptop screen on the right and QWindow reports, a dolphin window (760, 648) on the laptop screen and upon closing dolphin I get :

KWindowConfig::saveWindowSize QRect(0,0 2560x1440) QRect(0,0 760x648) QSize(760, 648) QRect(0,0 2560x1440) QSize(2560, 1440)

This was added in KWindowConfig::saveWindowSize

    qDebug() << "KWindowConfig::saveWindowSize" << window->screen()->geometry() << window->geometry() << window->size()
             << window->screen()->availableGeometry() << window->screen()->availableSize();