[KDE/Mac] Qt4/KDE4 issue with persistent window size across restarts on OS X 10.9
René J.V. Bertin
rjvbertin at gmail.com
Fri Feb 13 18:20:46 UTC 2015
Ok, I think I understand what's going on:
When using the MS Windows code:
{{{
void KMainWindow::restoreWindowSize( const KConfigGroup & _cg )
{
K_D(KMainWindow);
int scnum = QApplication::desktop()->screenNumber(window());
QRect desk = QApplication::desktop()->screenGeometry(scnum);
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desk.width()).arg(desk.height());
}}}
which means that the restored size is going to depend on what the windowmanager decides for the window's initial screen. On OS X that happens to be the main screen (at least if you stick with the legacy mode of having only a single menubar).
The X11-like code probably does something comparable.
Changing that but hanging on to the screen-specific size would require an additional key that keeps track of the last screen the window was opened on. It also seems a little bit far-fetched, as about the only time when a screen-resolution dependent size would be useful on OS X is when you've changed or removed an external screen. Native applications simply restore as much as they can from the last used geometry and position, scaling down the window if it opens on a screen of lower resolution.
So I think I'm going to try a version of {save,restore}WindowSize() that uses a key without the screen dimensions (just "geometry"), as shown in Qt's documentation for QWidget::saveGeometry().
R.
More information about the kde-mac
mailing list