STEPS TO REPRODUCE 1. Open Dolphin (app doesn't matter; any KXMLGui-using app that calls kwindowconfig::restoreWindowPosition() will do) 2. Move it to a distinctive place on screen 3. Maximize the window 4. Quit Dolphin 5. Re-open Dolphin 6. De-maximize Dolphin EXPECTED RESULT Dolphin is un-maximized to the position it was moved to in step 2. ACTUAL RESULT Dolphin is un-maximized to a position chosen by the current window placement mode. ADDITIONAL INFORMATION If you omit steps 4 and 5 (i.e you un-maximize it right after maximizing it), the bug is not seen.
*** Bug 435666 has been marked as a duplicate of this bug. ***
Looks like this is a two-part bug: 1. When the window is maximized, we write new position data to the config file even though this doesn't make sense (maximization and position on screen are mutually exclusive concepts). When a window is maximized, we should write to the config file only the fact that the window is maximized and not write out any new position data. 2. When KWin maximizes a window, it remembers the window's prior position internally but only while the window's app is open. If a window is closed while maximized, KWin forgets where the window was last located if that window is re-opened and de-maximized. It needs to be taught how to ask the app to position itself or read the config file itself in this case.
Git commit f5f12926b1ead2f36b2f7e8fc34ff864b5b6d60e by Nate Graham. Committed on 05/05/2021 at 03:59. Pushed by ngraham into branch 'master'. Don't write position data for maximized windows A window that is maximized does not really have a position on screen other then the fact that it's maximized, and writing out position data in this case anyway will only serve to mis-position the window once da-maximized, should KWin ever stop remembering de-maximized window positions internally. M +6 -0 src/gui/kwindowconfig.cpp https://invent.kde.org/frameworks/kconfig/commit/f5f12926b1ead2f36b2f7e8fc34ff864b5b6d60e
That fixes part 1; now we need a KWin change for part 2.
Moving to KWin now.
So basically the bug is that when a window is opened in a maximized state, de-maximizing it unconditionally positions it according to the active placement mode rather than first asking the window if it wants to position itself (which is what correctly happens for windows that are not opened in a maximized state).