Bug 476800 - KWrite and "minimal overlapping" window placement regressed since 22.08.3
Summary: KWrite and "minimal overlapping" window placement regressed since 22.08.3
Status: REOPENED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (other bugs)
Version First Reported In: 23.08.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-10 18:28 UTC by Luke Horwell
Modified: 2025-01-20 16:42 UTC (History)
1 user (show)

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


Attachments
Expected behaviour (kate 22.08.3) (129.30 KB, video/mp4)
2023-11-10 18:28 UTC, Luke Horwell
Details
Buggy behaviour (kwrite 23.08.2) (113.09 KB, video/mp4)
2023-11-10 18:29 UTC, Luke Horwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Horwell 2023-11-10 18:28:16 UTC
Created attachment 163018 [details]
Expected behaviour (kate 22.08.3)

SUMMARY

Around the release of Kate 22.12.0, opening KWrite windows with KDE's minimal overlapping option regressed since 22.08.3. The bug is still present at time of writing (23.08.2). However, the main Kate application open its windows as expected, so it seems specific to KWrite.

KDE -> System Settings -> Window Behaviour:
- Window placement: "Minimal Overlapping"
- Uncheck: "Allow apps to remember the positions of their own windows, if they support it."

Workaround: Downgrade kate to 22.08.3, since KWrite is part of Kate.

STEPS TO REPRODUCE
1. Start with an empty desktop.
2. Set the KDE setting above (minimal overlapping, don't remember positions)
3. Open multiple KWrite instances.

OBSERVED RESULT
Newly opened KWrite windows overlaps in a way that is inconsistent with other applications or 22.08.3.

EXPECTED RESULT
New  KWrite instances open without overlapping other windows, similar to 22.08.3 and versions prior.

SOFTWARE/OS VERSIONS
OS: Arch Linux
KDE Plasma Version: 5.27.9
KDE Frameworks Version: 5.111.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION
Please observe the attached videos demoing the before/after.
Comment 1 Luke Horwell 2023-11-10 18:29:24 UTC
Created attachment 163019 [details]
Buggy behaviour (kwrite 23.08.2)
Comment 2 Luke Horwell 2023-11-10 19:19:54 UTC
If it helps, I did a git bisect and found that 353bccf6c5fe0fa284c8cb51def259313e7c9e45 is the commit when the minimal overlapping breaks.

https://invent.kde.org/utilities/kate/-/commit/353bccf6c5fe0fa284c8cb51def259313e7c9e45
https://invent.kde.org/utilities/kate/-/network/master?extended_sha1=353bccf6c5fe0fa284c8cb51def259313e7c9e45

Thanks in advance!
Comment 3 Christoph Cullmann 2023-11-11 18:50:55 UTC
Hmmm, not sure how this has broken it, on the other side, I don't think I can just revert that without breaking something else.
Comment 4 Luke Horwell 2024-06-14 17:25:01 UTC
KWrite 24.05.1 still has an unusual way of arranging windows. I discovered a new workaround: Set up a Window Rule (KWin) to tell KWrite to "Ignore requested geometry" (Force) and set a size.
Comment 5 Christoph Cullmann 2024-10-19 21:03:14 UTC
I can not reproduce your behavior. I did take again a look at the code and see no obvious fault.
Comment 6 Luke Horwell 2024-10-19 23:57:27 UTC
I should've mentioned it only happens under X11, sorry, missing detail. Just had a quick test under Wayland, and it's OK there. I'm using a 4K screen.

Still happens under 24.08.2 in KWrite mode only. No issue under Kate mode. However, I have more info:

There is a "Restore Window Configuration" key (in katerc) that can be set in Kate (under Settings → Session → Include window configuration), but there is no way to set this in KWrite's GUI settings. If "Restore Window Configuration=true" ends up in kwriterc, or the key is not there, this bug is triggered. Presumably that means it's true by default?

Adding "Restore Window Configuration=false" to kwriterc no longer remembers the height/width of the window, but it does fix the improper minimal overlapping behaviour.

In practice, I would still need a window rule, since KWrite no longer behaves like Dolphin would, whereby the height/width is remembered, but the window placement is handled by the window manager.
Comment 7 Christoph Cullmann 2025-01-19 17:38:10 UTC
Could one try

https://invent.kde.org/utilities/kate/-/merge_requests/1697

if that helps?
Comment 8 Luke Horwell 2025-01-20 16:42:17 UTC
Tried your patch on Arch Linux by rebuilding kate 24.12.1 + 1697.patch.
I don't see much difference with the patch for this particular bug, under X11. Wayland is fine. All I noticed is the menu bar did disappear once "Restore Window Configuration=false" was added in kwriterc, and it remembers my preference (menu bar visible) on next launch.

A quick recap of this bug:

- Only affects X11 session. Wayland works fine.
- Only affects KWrite. Kate works fine.
- With minimal overlapping set in Plasma, KWrite opens in buggy 'minimal' positions (overlapping a window, opening in same spot, etc).
- On X11, manually adding "Restore Window Configuration=false" under [General] in ~/.config/kwriterc fixes the buggy overlapping, but the height/width is no longer remembered. [see workaround]
- On Wayland, don't add "Restore Window Configuration=false". This is the default.
- This GUI option to change this setting is missing in KWrite.

Workaround (for X11):
- Add line to ~/.config/kwriterc [see above].
- Add a window rule to set a height/width (and possibly force "Ignore geometry" for good measure). Now on par with how a Dolphin window behaves.

Since it seems to be only me with this issue, and with X11 being deprecated long-term, the status quo with the above workaround works for me. I don't mind if this is closed as a WONTFIX. 

However, a possible solution for this bug could be to add the missing "Include window configuration" checkbox (in the "Session Elements" group) for KWrite too.