[kwindowconfig] Restore window size wrt better screen

By default the window size is restored with respect to the screen at
0,0; this patch uses the screen under mouse cursor.  It is still not
optimal, as one would have to have a way to query the workspace for
the current screen.  Is there any reasonable way to do that?
wilder
Jacopo De Simoi 6 years ago
parent 60f18e6c3c
commit cfcca5216d
  1. 6
      src/gui/kwindowconfig.cpp

@ -10,6 +10,9 @@
#include <QGuiApplication>
#include <QScreen>
#include <QWindow>
#include <QDebug>
#include <QCursor>
#include <QGuiApplication>
static const char s_initialSizePropertyName[] = "_kconfig_initial_size";
static const char s_initialScreenSizePropertyName[] = "_kconfig_initial_screen_size";
@ -56,8 +59,7 @@ void KWindowConfig::restoreWindowSize(QWindow *window, const KConfigGroup &confi
return;
}
const QRect desk = window->screen()->geometry();
const QRect desk = QGuiApplication::screenAt(QCursor::pos())->geometry();
// Fall back to non-per-screen-arrangement info if it's available but
// per-screen-arrangement information is not
const int fallbackWidth = config.readEntry(QStringLiteral("Width %1").arg(desk.width()), window->size().width());

Loading…
Cancel
Save