Review Request 119337: Wait for KMainWindow size restoring before auto saving the size

Martin Klapetek martin.klapetek at gmail.com
Thu Jul 17 14:41:21 UTC 2014



> On July 17, 2014, 3:42 p.m., Martin Gräßlin wrote:
> > would it be possible to add a unit test for it? I know it's not easy as it depends on the window manager, but Openbox which is used on the CI system is quite decent.
> 
> Martin Klapetek wrote:
>     I may try
> 
> Christoph Feck wrote:
>     Please add/close bug 337353.

This unfortunately does not fix Dolphin :/

I've been investigating this since yesterday and the core problem of that bug seems to be in Qt, qwidget_qpa.cpp line 549 (void QWidgetPrivate::show_sys()), there's this:

        QRect geomRect = q->geometry();
        ...
        const QRect windowRect = window->geometry();
        if (windowRect != geomRect) {
            if (q->testAttribute(Qt::WA_Moved)
                || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowManagement))
                window->setGeometry(geomRect);
            else
                window->resize(geomRect.size());
        }

For some reason the "if (windowRect != geomRect)" is true (where windowRect has the correctly restored size, but geomRect does not yet). Delaying the show() call in Dolphin with a single-shot timer actually makes this work properly, so my bet on that bug would be a race condition as the resize calls QXcbWindow::resize() which does async XCB calls. But I'm no expert in this so that might be a complete non-sense...


- Martin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/119337/#review62576
-----------------------------------------------------------


On July 17, 2014, 3:21 p.m., Martin Klapetek wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119337/
> -----------------------------------------------------------
> 
> (Updated July 17, 2014, 3:21 p.m.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: kxmlgui
> 
> 
> Description
> -------
> 
> Playing a bit with the KXmlGuiWindow test showed that it didn't restore its size properly on reopening. I found out that KWindowConfig::saveWindowSize() is called before KWindowConfig::restoreWindowSize() which results in overwriting the values in the config file and KWindowConfig::restoreWindowSize() then reads the changed values.
> 
> So this patch calls KWindowConfig::saveWindowSize() only after we have applied the size from the config file. Additionally, it checks if the windowHandle() we're trying to resize is NULL as that can result in no resize and yet the d->sizeApplied being wrongly set to true.
> 
> 
> Diffs
> -----
> 
>   src/kmainwindow.cpp e273a76 
> 
> Diff: https://git.reviewboard.kde.org/r/119337/diff/
> 
> 
> Testing
> -------
> 
> KXmlGuiWindow (the one in tests/) now correctly stores & restores its size.
> 
> 
> Thanks,
> 
> Martin Klapetek
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140717/5b1f2e9c/attachment.html>


More information about the Kde-frameworks-devel mailing list