Fix QPlatformWindow::initialGeometry() to not touch large windows.
Do not touch windows whose geometry (including the unknown frame size) is likely to be larger than the screen. Remove fix-up in the Windows plugin. Task-number: QTBUG-30142 Task-number: QTBUG-31071 Change-Id: I13a8ffb9fb9d8c71d35de75094275388fa427f2c Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>bb10
parent
85a6446164
commit
81e981a704
|
|
@ -510,15 +510,21 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w,
|
|||
}
|
||||
}
|
||||
if (w->isTopLevel() && qt_window_private(const_cast<QWindow*>(w))->positionAutomatic) {
|
||||
const QWindow *tp = w->transientParent();
|
||||
if (tp) {
|
||||
// A transient window should be centered w.r.t. its transient parent.
|
||||
rect.moveCenter(tp->geometry().center());
|
||||
} else {
|
||||
// Center the window on the screen. (Only applicable on platforms
|
||||
// which do not provide a better way.)
|
||||
QPlatformScreen *scr = QPlatformScreen::platformScreenForWindow(w);
|
||||
rect.moveCenter(scr->availableGeometry().center());
|
||||
if (const QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w)) {
|
||||
const QRect availableGeometry = platformScreen->availableGeometry();
|
||||
// Center unless the geometry ( + unknown window frame) is too large for the screen).
|
||||
if (rect.height() < (availableGeometry.height() * 8) / 9
|
||||
&& rect.width() < (availableGeometry.width() * 8) / 9) {
|
||||
const QWindow *tp = w->transientParent();
|
||||
if (tp) {
|
||||
// A transient window should be centered w.r.t. its transient parent.
|
||||
rect.moveCenter(tp->geometry().center());
|
||||
} else {
|
||||
// Center the window on the screen. (Only applicable on platforms
|
||||
// which do not provide a better way.)
|
||||
rect.moveCenter(availableGeometry.center());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rect;
|
||||
|
|
|
|||
|
|
@ -503,15 +503,6 @@ QWindowsWindow::WindowData
|
|||
const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, data.customMargins, style, exStyle));
|
||||
QWindowsContext::instance()->setWindowCreationContext(context);
|
||||
|
||||
QRect screenGeometry;
|
||||
if (QScreen *screen = w->screen())
|
||||
screenGeometry = screen->availableVirtualGeometry();
|
||||
|
||||
if (context->frameX < screenGeometry.left())
|
||||
context->frameX = screenGeometry.left();
|
||||
if (context->frameY < screenGeometry.top())
|
||||
context->frameY = screenGeometry.top();
|
||||
|
||||
if (QWindowsContext::verboseWindows)
|
||||
qDebug().nospace()
|
||||
<< "CreateWindowEx: " << w << *this
|
||||
|
|
|
|||
Loading…
Reference in New Issue