Version: (using KDE Devel) Installed from: Compiled sources OS: Linux See attached testcase (intentionally no .ui file). The size of the window is always correctly restored except if it was maximized when you closed the application. In this case it uses some default size when you launch it again. Outcommenting "mainWindow->createGUI();" makes the whole thing working as expected. PS: Yes, I know this bug is something _very_ fishy and I hope you're able to reproduce it ...
Created attachment 21811 [details] testcase
not reproducible anymore ...
Can this be the cause for bug #119393 (kde3) or bug #137108 (kde4)?
Although the testcase above works now, the real life behind it doesn't. At least kaffeine and okular (and likely others too) don't restore their size correctly if they were maximized when you closed them. Using QWidget::showMaximized() instead of KWindowSystem::setState() in KMainWindow::restoreWindowSize() solves it for both cases.
I can trigger this bug (in KDE4) with with okular, kbounce and kiriki, but not with but not with lkskat or kgoldrunner.
I spent some hours with debugging this issue. I still don't understand completely what's going on, but let me elaborate: When the window was maximized when it was closed, KMainWindow::restoreWindowSize(..) not set a window size, but it calls KWindowSystem::setState( winId(), state ) with "state = NET::MaxHoriz | NET::MaxVert". KWindowSystem::setState(..) then calls NETWinInfo::setState( state, state ) which will call XChangeProperty(..). Afterwards _NET_WM_STATE_MAXIMIZED_VERT and _NET_WM_STATE_MAXIMIZED_HORZ of the window will be set, but the size isn't changed. Why? I don't know. Is this a feature of XChangeProperty(..) which just sets the flags, but doesn't resize the window? Anyway, setting the window size in KMainWindow::restoreWindowSize(..) to the desktop size solves the problem. The window behaves as expected. Find the simple patch attached. As I said I don't know, it the behaviour of KWindowSystem::setState(..) and everything it calls is the way it has to be, that's why the real solution may be something else... The patch is at least a workaround for a very very nasty bug.
Created attachment 23551 [details] Simple patch to restore maximized windows maximized
Hmm... and setWindowState(Qt::WindowMaximized); doesn't work ? Just talking about the patch itself, don't know if that is even correct in this context.
setWindowState(Qt::WindowMaximized) also doesn't work.
Just to be sure I printed out width() and height() before and after the KWindowSystem::setState(..) call. They were both times (768,334). Here the ouptut, repeated three times (why?) ---------- KMainWindow::restoreWindowSize (widht,height) before: (768,334) NETWinInfo::NETWinInfo: constructing object with role 'Client' NETWinInfo::setState: setting state property (2) NETWinInfo::setState: state 305 '_NET_WM_STATE_MAXIMIZED_VERT' NETWinInfo::setState: state 328 '_NET_WM_STATE_MAXIMIZED_HORZ' NET: decrementing NETWinInfoPrivate::ref (0) NET: no more references, deleting KMainWindow::restoreWindowSize after: (768,334) KMainWindow::restoreWindowSize (widht,height) before: (768,334) ----------
Created attachment 25292 [details] testcase for r819912 recreated the testcase for kdelibs r819912 it might or might not work for you though (when you look at the irreducible lines you should notice that the issue here is indeed fishy)
Patch from #c7 corrected the bad behaviour for Okular and Krusader for KDE 4.0.99 (ArchLinux with KDEMod)
I can confirm this bug on kde 4.1 svn.
So, is anyone working on the issue? It was brought up on k-c-d some time ago, but it seems as if nothing happened so far. It was a Qt-Bug, right? Does anyone know if it has been reported to TT^WNokia?
Sorry for the noise. Hit enter by accident and assigned the bug to myself...
KDE 4.1.2 still has this bug
Still there in 4.1.3
This is a qt bug and its fixed in qt 4.5.
Oh sorry I messed up with another bug, so ignore my previous message.
I was hoping it was fixed :P
Fixed on revision 880489
Great! :) It's sad it did not make it in time for 4.1.3... ;) Thanx for commiting.
Sorry for the noice, but the fix went into kdelibs right? Thanks in advance PS: I'm asking because this is worth a recompile! :D
Yes, the fix is on kdelibs (trunk).
SVN commit 886844 by wstephens: Backport r880489 to 4.1 CCBUG:150772 M +4 -3 kmainwindow.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=886844