Commit 39f7171d authored by Nate Graham's avatar Nate Graham 🔩
Browse files

Allow opting out of remembering window positions on X11

Various people have requested this, for reasons that seem sensible
enough to me:
- Some people like the KWin positioning modes and want all windows to
  follow them
- It might be annoying to have only KDE apps follow this setting and
  preferable to not use it at all for pepole who use mostly non-KDE apps
- The per-screen-arrangement memory feature may interact strangely or in
  a buggy manner for some people's screen arrangements

For those reasons, it seems reasonable to allow disabling the feature,
though it still remains on by default. This commit turns it off if
`AllowKDEAppsToRememberWindowPositions=false` is set in the user's
`kdeglobals` file. A GUI to toggle this will be added in a separate
commit to some System Settings KCM.

CCBUG: 415150
parent bbcfcc53
...@@ -697,12 +697,20 @@ void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg) ...@@ -697,12 +697,20 @@ void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg)
// window was created -> QTBUG-40584. We therefore copy the size here. // window was created -> QTBUG-40584. We therefore copy the size here.
// TODO: remove once this was resolved in QWidget QPA // TODO: remove once this was resolved in QWidget QPA
resize(windowHandle()->size()); resize(windowHandle()->size());
// TODO: how should we handle the case when a new instance is opened and
// There's stored window position data? Cascade the new window? Don't // Let the user opt out of KDE apps remembering window sizes if they
// restore position and let the window manager handle it? Can we even // find it annoying or it doesn't work for them due to other bugs.
// know this from here? // When called with no args, this looks at kdeglobals
KWindowConfig::restoreWindowPosition(windowHandle(), cg); KSharedConfigPtr config = KSharedConfig::openConfig();
d->sizeApplied = true; KConfigGroup group(config, "General");
if (group.readEntry("AllowKDEAppsToRememberWindowPositions", true)) {
// TODO: how should we handle the case when a new instance is opened
// and there's stored window position data? Cascade the new window?
// Don't restore position and let the window manager handle it? Can
// we even know this from here?
KWindowConfig::restoreWindowPosition(windowHandle(), cg);
d->sizeApplied = true;
}
} }
QStatusBar *sb = internalStatusBar(this); QStatusBar *sb = internalStatusBar(this);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment