Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
This commit is contained in:
commit
977c8a4d18
@ -1864,19 +1864,19 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
|
|||||||
static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
|
static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
|
||||||
break;
|
break;
|
||||||
case QWindowSystemInterfacePrivate::ScreenOrientation:
|
case QWindowSystemInterfacePrivate::ScreenOrientation:
|
||||||
QGuiApplicationPrivate::reportScreenOrientationChange(
|
QGuiApplicationPrivate::processScreenOrientationChange(
|
||||||
static_cast<QWindowSystemInterfacePrivate::ScreenOrientationEvent *>(e));
|
static_cast<QWindowSystemInterfacePrivate::ScreenOrientationEvent *>(e));
|
||||||
break;
|
break;
|
||||||
case QWindowSystemInterfacePrivate::ScreenGeometry:
|
case QWindowSystemInterfacePrivate::ScreenGeometry:
|
||||||
QGuiApplicationPrivate::reportGeometryChange(
|
QGuiApplicationPrivate::processScreenGeometryChange(
|
||||||
static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e));
|
static_cast<QWindowSystemInterfacePrivate::ScreenGeometryEvent *>(e));
|
||||||
break;
|
break;
|
||||||
case QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInch:
|
case QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInch:
|
||||||
QGuiApplicationPrivate::reportLogicalDotsPerInchChange(
|
QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(
|
||||||
static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e));
|
static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e));
|
||||||
break;
|
break;
|
||||||
case QWindowSystemInterfacePrivate::ScreenRefreshRate:
|
case QWindowSystemInterfacePrivate::ScreenRefreshRate:
|
||||||
QGuiApplicationPrivate::reportRefreshRateChange(
|
QGuiApplicationPrivate::processScreenRefreshRateChange(
|
||||||
static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e));
|
static_cast<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *>(e));
|
||||||
break;
|
break;
|
||||||
case QWindowSystemInterfacePrivate::ThemeChange:
|
case QWindowSystemInterfacePrivate::ThemeChange:
|
||||||
@ -2907,7 +2907,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e)
|
void QGuiApplicationPrivate::processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
@ -2944,7 +2944,7 @@ void QGuiApplicationPrivate::reportScreenOrientationChange(QScreen *s)
|
|||||||
QCoreApplication::sendEvent(QCoreApplication::instance(), &event);
|
QCoreApplication::sendEvent(QCoreApplication::instance(), &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
|
void QGuiApplicationPrivate::processScreenGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
@ -2987,7 +2987,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e)
|
void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
@ -3002,7 +3002,7 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
|
|||||||
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
|
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e)
|
void QGuiApplicationPrivate::processScreenRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e)
|
||||||
{
|
{
|
||||||
// This operation only makes sense after the QGuiApplication constructor runs
|
// This operation only makes sense after the QGuiApplication constructor runs
|
||||||
if (QCoreApplication::startingUp())
|
if (QCoreApplication::startingUp())
|
||||||
|
@ -139,10 +139,10 @@ public:
|
|||||||
|
|
||||||
static void updateFilteredScreenOrientation(QScreen *screen);
|
static void updateFilteredScreenOrientation(QScreen *screen);
|
||||||
static void reportScreenOrientationChange(QScreen *screen);
|
static void reportScreenOrientationChange(QScreen *screen);
|
||||||
static void reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e);
|
static void processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e);
|
||||||
static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
|
static void processScreenGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
|
||||||
static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e);
|
static void processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e);
|
||||||
static void reportRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e);
|
static void processScreenRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e);
|
||||||
static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce);
|
static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce);
|
||||||
|
|
||||||
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
|
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
|
||||||
|
@ -103,6 +103,20 @@ QWindow *QPlatformScreen::topLevelAt(const QPoint & pos) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return all windows residing on this screen.
|
||||||
|
*/
|
||||||
|
QWindowList QPlatformScreen::windows() const
|
||||||
|
{
|
||||||
|
QWindowList windows;
|
||||||
|
for (QWindow *window : QGuiApplication::allWindows()) {
|
||||||
|
if (platformScreenForWindow(window) != this)
|
||||||
|
continue;
|
||||||
|
windows.append(window);
|
||||||
|
}
|
||||||
|
return windows;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Find the sibling screen corresponding to \a globalPos.
|
Find the sibling screen corresponding to \a globalPos.
|
||||||
|
|
||||||
@ -369,25 +383,17 @@ QPlatformCursor *QPlatformScreen::cursor() const
|
|||||||
*/
|
*/
|
||||||
void QPlatformScreen::resizeMaximizedWindows()
|
void QPlatformScreen::resizeMaximizedWindows()
|
||||||
{
|
{
|
||||||
QList<QWindow*> windows = QGuiApplication::allWindows();
|
|
||||||
|
|
||||||
// 'screen()' still has the old geometry info while 'this' has the new geometry info
|
// 'screen()' still has the old geometry info while 'this' has the new geometry info
|
||||||
const QRect oldGeometry = screen()->geometry();
|
const QRect oldGeometry = screen()->geometry();
|
||||||
const QRect oldAvailableGeometry = screen()->availableGeometry();
|
const QRect oldAvailableGeometry = screen()->availableGeometry();
|
||||||
const QRect newGeometry = deviceIndependentGeometry();
|
const QRect newGeometry = deviceIndependentGeometry();
|
||||||
const QRect newAvailableGeometry = QHighDpi::fromNative(availableGeometry(), QHighDpiScaling::factor(this), newGeometry.topLeft());
|
const QRect newAvailableGeometry = QHighDpi::fromNative(availableGeometry(), QHighDpiScaling::factor(this), newGeometry.topLeft());
|
||||||
|
|
||||||
// make sure maximized and fullscreen windows are updated
|
for (QWindow *w : windows()) {
|
||||||
for (int i = 0; i < windows.size(); ++i) {
|
|
||||||
QWindow *w = windows.at(i);
|
|
||||||
|
|
||||||
// Skip non-platform windows, e.g., offscreen windows.
|
// Skip non-platform windows, e.g., offscreen windows.
|
||||||
if (!w->handle())
|
if (!w->handle())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (platformScreenForWindow(w) != this)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry)
|
if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry)
|
||||||
w->setGeometry(newAvailableGeometry);
|
w->setGeometry(newAvailableGeometry);
|
||||||
else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry)
|
else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry)
|
||||||
|
@ -123,6 +123,8 @@ public:
|
|||||||
virtual void setOrientationUpdateMask(Qt::ScreenOrientations mask);
|
virtual void setOrientationUpdateMask(Qt::ScreenOrientations mask);
|
||||||
|
|
||||||
virtual QWindow *topLevelAt(const QPoint &point) const;
|
virtual QWindow *topLevelAt(const QPoint &point) const;
|
||||||
|
QWindowList windows() const;
|
||||||
|
|
||||||
virtual QList<QPlatformScreen *> virtualSiblings() const;
|
virtual QList<QPlatformScreen *> virtualSiblings() const;
|
||||||
const QPlatformScreen *screenForPosition(const QPoint &point) const;
|
const QPlatformScreen *screenForPosition(const QPoint &point) const;
|
||||||
|
|
||||||
|
@ -159,13 +159,13 @@ void QCocoaBackingStore::flush(QWindow *window, const QRegion ®ion, const QPo
|
|||||||
|
|
||||||
const qreal devicePixelRatio = m_image.devicePixelRatio();
|
const qreal devicePixelRatio = m_image.devicePixelRatio();
|
||||||
|
|
||||||
// If the flushed window is a content view, and not in unified toolbar mode,
|
// If the flushed window is a content view, and we're filling the drawn area
|
||||||
// and is fully opaque, we can get away with copying the backingstore instead
|
// completely, or it doesn't have a window background we need to preserve,
|
||||||
// of blending.
|
// we can get away with copying instead of blending the backing store.
|
||||||
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
|
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window->handle());
|
||||||
const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
|
const NSCompositingOperation compositingOperation = cocoaWindow->isContentView()
|
||||||
&& cocoaWindow->isOpaque() && !windowHasUnifiedToolbar() ?
|
&& (cocoaWindow->isOpaque() || view.window.backgroundColor == NSColor.clearColor)
|
||||||
NSCompositingOperationCopy : NSCompositingOperationSourceOver;
|
? NSCompositingOperationCopy : NSCompositingOperationSourceOver;
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults]
|
static bool debugBackingStoreFlush = [[NSUserDefaults standardUserDefaults]
|
||||||
|
@ -147,7 +147,9 @@ void QCocoaScreen::updateProperties()
|
|||||||
|
|
||||||
m_name = displayName(dpy);
|
m_name = displayName(dpy);
|
||||||
|
|
||||||
if (m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry)
|
const bool didChangeGeometry = m_geometry != previousGeometry || m_availableGeometry != previousAvailableGeometry;
|
||||||
|
|
||||||
|
if (didChangeGeometry)
|
||||||
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
|
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
|
||||||
if (m_logicalDpi != previousLogicalDpi)
|
if (m_logicalDpi != previousLogicalDpi)
|
||||||
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), m_logicalDpi.first, m_logicalDpi.second);
|
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), m_logicalDpi.first, m_logicalDpi.second);
|
||||||
@ -155,6 +157,22 @@ void QCocoaScreen::updateProperties()
|
|||||||
QWindowSystemInterface::handleScreenRefreshRateChange(screen(), m_refreshRate);
|
QWindowSystemInterface::handleScreenRefreshRateChange(screen(), m_refreshRate);
|
||||||
|
|
||||||
qCDebug(lcQpaScreen) << "Updated properties for" << this;
|
qCDebug(lcQpaScreen) << "Updated properties for" << this;
|
||||||
|
|
||||||
|
if (didChangeGeometry) {
|
||||||
|
// When a screen changes its geometry, AppKit will send us a NSWindowDidMoveNotification
|
||||||
|
// for each window, resulting in calls to handleGeometryChange(), but this happens before
|
||||||
|
// the NSApplicationDidChangeScreenParametersNotification, so when we map the new geometry
|
||||||
|
// (which is correct at that point) to the screen using QCocoaScreen::mapFromNative(), we
|
||||||
|
// end up using the stale screen geometry, and the new window geometry we report is wrong.
|
||||||
|
// To make sure we finally report the correct window geometry, we need to do another pass
|
||||||
|
// of geometry reporting, now that the screen properties have been updates. FIXME: Ideally
|
||||||
|
// this would be solved by not caching the screen properties in QCocoaScreen, but that
|
||||||
|
// requires more research.
|
||||||
|
for (QWindow *window : windows()) {
|
||||||
|
if (QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow*>(window->handle()))
|
||||||
|
cocoaWindow->handleGeometryChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------- Display link -----------------------
|
// ----------------------- Display link -----------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user