Bug 429943 - Window size broken on Windows
Summary: Window size broken on Windows
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kconfig
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.76.0
Platform: Microsoft Windows Microsoft Windows
: VHI major
Target Milestone: ---
Assignee: Matthew Dawson
URL:
Keywords: regression
: 429264 429734 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-12-02 20:14 UTC by Jean-Baptiste Mardelle
Modified: 2022-11-16 15:34 UTC (History)
7 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Baptiste Mardelle 2020-12-02 20:14:20 UTC
SUMMARY
Seems like a recent KConfigWindow Change broke restoring Window size and more generally the rc file. Issue reported against Kate and Kdenlive on Windows.

I think the reason is this change:
https://invent.kde.org/frameworks/kconfig/-/commit/1434257972de28f183e701cb7da3bd333fa71f3c#note_145662

See comments in commit, the rc file is now corrupted with escape sequences, like:
------------
[MainWindow]
\t 1080=480
\th 1920=886
\ndow-Maximized 1080x1920=true
\sition=23
----------

STEPS TO REPRODUCE
1. Open a KDE App on Windows
2. Close it
3. Reopen, 

OBSERVED RESULT
It doesn't remember the window size, for example Kdenlive always restarts with a very small Window.

EXPECTED RESULT
Restore last window dimensions


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

Related bugs:
Kate: https://bugs.kde.org/show_bug.cgi?id=429734
Kdenlive: https://bugs.kde.org/show_bug.cgi?id=429264
Comment 1 Nate Graham 2020-12-07 18:34:35 UTC
*** Bug 429734 has been marked as a duplicate of this bug. ***
Comment 2 Nate Graham 2020-12-07 18:34:41 UTC
*** Bug 429264 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2020-12-07 18:37:13 UTC
The attached rc file in Bug 429264 shows that many lines in the config file are truncated and have inappropriate slashes added, not just the ones that were changed for the window position saving code. I suspect an unrelated regression in either KConfig or Qt.
Comment 4 Nate Graham 2020-12-07 19:22:08 UTC
Seems like QScreen::name() gives us garbage on Windows and this is a known issue: https://bugreports.qt.io/browse/QTBUG-74317

I'll add a workaround.
Comment 5 Bug Janitor Service 2020-12-07 19:29:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kconfig/-/merge_requests/35
Comment 6 Nate Graham 2020-12-07 22:16:44 UTC
Git commit e5fb03b6e915b176ae8804ae7317ff1977848487 by Nate Graham.
Committed on 07/12/2020 at 22:15.
Pushed by ngraham into branch 'master'.

Fix window sizing and positioning on Windows

The feature to make windows remember their sizes and positions across
screen layouts relied on calling QScreen::name() to identify screens.
Unfortunately this function returns garbage on Windows; see
https://bugreports.qt.io/browse/QTBUG-74317

So on Windows, let's identify displays by serial number as a workaround.
FIXED-IN: 5.78

M  +6    -0    src/gui/kwindowconfig.cpp

https://invent.kde.org/frameworks/kconfig/commit/e5fb03b6e915b176ae8804ae7317ff1977848487
Comment 7 Jason Craig 2020-12-13 18:51:22 UTC
Just FYI it does not appear that this was the problem in the bug I reported. The problem is not present in Kate 20.12.0 which reports using Frameworks 5.76.0.
Comment 8 Davy Bartoloni 2021-01-29 09:06:42 UTC
on latest Kdenlive configuration file there are again some texts added:

on Windows10 there is a "\s ":                        \s Height 1080=900  
and on Windows 7 and Windows 8.1 there is a "\s":     \sHeight 1080=900
Comment 9 Davy Bartoloni 2022-11-12 08:02:28 UTC
on Kdenlive (this week) there was a regression and now there are again strange values on the configuration file (Windows version)

https://invent.kde.org/multimedia/kdenlive/uploads/3f35d638bdfa8078ce0a89e59b349892/slashes.png
Comment 10 Bug Janitor Service 2022-11-14 16:03:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kconfig/-/merge_requests/148
Comment 11 Nate Graham 2022-11-16 00:57:48 UTC
Git commit a66d57f5e48486ce67d4dc9ea6c980a160466371 by Nate Graham.
Committed on 16/11/2022 at 00:49.
Pushed by ngraham into branch 'master'.

Apply existing  QScreen::name() workaround for Windows to new code

e5fb03b6e915b176ae8804ae7317ff1977848487 added a workaround for a Qt
bug on Windows that makes QScreen::name() return garbage.

21e02655a78b5d241c35fd934f7665564420327c added new un-worked-around
usages of QScreen::name() which effectively re-introduces the bug that
the old code was fixing on Windows.

This commit re-applies the workaround to the new code using a compiler
macro.
FIXED-IN: 5.101

M  +17   -14   src/gui/kwindowconfig.cpp

https://invent.kde.org/frameworks/kconfig/commit/a66d57f5e48486ce67d4dc9ea6c980a160466371