summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-03-14 00:36:34 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-03-19 13:08:25 +0000
commit01e1df90a7debd333314720fdd5cf6cd9964d796 (patch)
tree1a5c9e7b6921630d99f52fa46072da20752a6350 /src
parentdc753374478d751c7c124030429e90d058934f9f (diff)
Move screen maintenance functions from QPlatformIntegration to QWSI
QWindowSystemInterface is the de facto API for any plumbing going from the platform plugin to QtGui. Having the functions as protected members of QPlatformIntegration was idiosyncratic, and resulted in awkward workarounds to be able to call the functions from outside of the QPlatformIntegration subclass. The functions in QPlatformIntegration have been left in, but deprecated so that platform plugins outside of qtbase have a chance to move over to the new QWSI API before they are removed. Change-Id: I327fec460db6b0faaf0ae2a151c20aa30dbe7182 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformintegration.cpp58
-rw-r--r--src/gui/kernel/qplatformintegration.h12
-rw-r--r--src/gui/kernel/qplatformscreen.cpp5
-rw-r--r--src/gui/kernel/qscreen.h1
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp64
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h4
-rw-r--r--src/plugins/platforms/android/qandroidplatformintegration.cpp2
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbintegration.cpp5
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm6
-rw-r--r--src/plugins/platforms/directfb/qdirectfb_egl.cpp3
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.cpp3
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp4
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp12
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration_p.h3
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp2
-rw-r--r--src/plugins/platforms/haiku/qhaikuintegration.cpp5
-rw-r--r--src/plugins/platforms/integrity/qintegrityfbintegration.cpp6
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h4
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm4
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm10
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp5
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp3
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.cpp5
-rw-r--r--src/plugins/platforms/mirclient/qmirclientintegration.cpp7
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.cpp3
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.cpp11
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdintegration.h2
-rw-r--r--src/plugins/platforms/openwfd/qopenwfdport.cpp4
-rw-r--r--src/plugins/platforms/qnx/qqnxintegration.cpp6
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.cpp5
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h3
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp8
-rw-r--r--src/plugins/platforms/winrt/qwinrtintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_screens.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.h2
38 files changed, 159 insertions, 147 deletions
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 7d1fcd4eeb..ac4d12b024 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -463,37 +463,16 @@ QList<int> QPlatformIntegration::possibleKeys(const QKeyEvent *) const
}
/*!
- Should be called by the implementation whenever a new screen is added.
-
- The first screen added will be the primary screen, used for default-created
- windows, GL contexts, and other resources unless otherwise specified.
-
- This adds the screen to QGuiApplication::screens(), and emits the
- QGuiApplication::screenAdded() signal.
-
- The screen should be deleted by calling QPlatformIntegration::destroyScreen().
+ \deprecated Use QWindowSystemInterface::handleScreenAdded instead.
*/
void QPlatformIntegration::screenAdded(QPlatformScreen *ps, bool isPrimary)
{
- QScreen *screen = new QScreen(ps);
-
- if (isPrimary) {
- QGuiApplicationPrivate::screen_list.prepend(screen);
- } else {
- QGuiApplicationPrivate::screen_list.append(screen);
- }
- emit qGuiApp->screenAdded(screen);
-
- if (isPrimary)
- emit qGuiApp->primaryScreenChanged(screen);
+ QWindowSystemInterface::handleScreenAdded(ps, isPrimary);
}
/*!
- Just removes the screen, call destroyScreen instead.
-
- \sa destroyScreen()
+ \deprecated Use QWindowSystemInterface::handleScreenRemoved instead.
*/
-
void QPlatformIntegration::removeScreen(QScreen *screen)
{
const bool wasPrimary = (!QGuiApplicationPrivate::screen_list.isEmpty() && QGuiApplicationPrivate::screen_list.at(0) == screen);
@@ -504,38 +483,19 @@ void QPlatformIntegration::removeScreen(QScreen *screen)
}
/*!
- Should be called by the implementation whenever a screen is removed.
-
- This removes the screen from QGuiApplication::screens(), and deletes it.
-
- Failing to call this and manually deleting the QPlatformScreen instead may
- lead to a crash due to a pure virtual call.
+ \deprecated Use QWindowSystemInterface::handleScreenRemoved instead.
*/
-void QPlatformIntegration::destroyScreen(QPlatformScreen *screen)
+void QPlatformIntegration::destroyScreen(QPlatformScreen *platformScreen)
{
- QScreen *qScreen = screen->screen();
- removeScreen(qScreen);
- delete qScreen;
- delete screen;
+ QWindowSystemInterface::handleScreenRemoved(platformScreen);
}
/*!
- Should be called whenever the primary screen changes.
-
- When the screen specified as primary changes, this method will notify
- QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal.
- */
-
+ \deprecated Use QWindowSystemInterface::handlePrimaryScreenChanged instead.
+*/
void QPlatformIntegration::setPrimaryScreen(QPlatformScreen *newPrimary)
{
- QScreen* newPrimaryScreen = newPrimary->screen();
- int idx = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
- Q_ASSERT(idx >= 0);
- if (idx == 0)
- return;
-
- QGuiApplicationPrivate::screen_list.swap(0, idx);
- emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
+ QWindowSystemInterface::handlePrimaryScreenChanged(newPrimary);
}
QStringList QPlatformIntegration::themeNames() const
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index efb1481f6d..1179daeb32 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -190,7 +190,9 @@ public:
#endif
virtual void setApplicationIcon(const QIcon &icon) const;
- void removeScreen(QScreen *screen);
+#if QT_DEPRECATED_SINCE(5, 12)
+ QT_DEPRECATED_X("Use QWindowSystemInterface::handleScreenRemoved") void removeScreen(QScreen *screen);
+#endif
virtual void beep() const;
@@ -199,9 +201,11 @@ public:
#endif
protected:
- void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
- void destroyScreen(QPlatformScreen *screen);
- void setPrimaryScreen(QPlatformScreen *newPrimary);
+#if QT_DEPRECATED_SINCE(5, 12)
+ QT_DEPRECATED_X("Use QWindowSystemInterface::handleScreenAdded") void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
+ QT_DEPRECATED_X("Use QWindowSystemInterface::handleScreenRemoved") void destroyScreen(QPlatformScreen *screen);
+ QT_DEPRECATED_X("Use QWindowSystemInterface::handlePrimaryScreenChanged") void setPrimaryScreen(QPlatformScreen *newPrimary);
+#endif
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index b7b312e89e..21ae75ba8f 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -61,8 +61,11 @@ QPlatformScreen::~QPlatformScreen()
{
Q_D(QPlatformScreen);
if (d->screen) {
- qWarning("Manually deleting a QPlatformScreen. Call QPlatformIntegration::destroyScreen instead.");
+ qWarning("Manually deleting a QPlatformScreen. Call QWindowSystemInterface::handleScreenRemoved instead.");
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QGuiApplicationPrivate::platformIntegration()->removeScreen(d->screen);
+QT_WARNING_POP
delete d->screen;
}
}
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 8c9b16e08e..14392d3036 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -169,6 +169,7 @@ private:
friend class QPlatformIntegration;
friend class QPlatformScreen;
friend class QHighDpiScaling;
+ friend class QWindowSystemInterface;
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 7067ece1d8..b0f2869128 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -780,6 +780,70 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *window, ulong
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
+/*!
+ Should be called by the implementation whenever a new screen is added.
+
+ The first screen added will be the primary screen, used for default-created
+ windows, GL contexts, and other resources unless otherwise specified.
+
+ This adds the screen to QGuiApplication::screens(), and emits the
+ QGuiApplication::screenAdded() signal.
+
+ The screen should be deleted by calling QWindowSystemInterface::handleScreenRemoved().
+*/
+void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrimary)
+{
+ QScreen *screen = new QScreen(ps);
+
+ if (isPrimary)
+ QGuiApplicationPrivate::screen_list.prepend(screen);
+ else
+ QGuiApplicationPrivate::screen_list.append(screen);
+
+ emit qGuiApp->screenAdded(screen);
+
+ if (isPrimary)
+ emit qGuiApp->primaryScreenChanged(screen);
+}
+
+/*!
+ Should be called by the implementation whenever a screen is removed.
+
+ This removes the screen from QGuiApplication::screens(), and deletes it.
+
+ Failing to call this and manually deleting the QPlatformScreen instead may
+ lead to a crash due to a pure virtual call.
+*/
+void QWindowSystemInterface::handleScreenRemoved(QPlatformScreen *platformScreen)
+{
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ QGuiApplicationPrivate::platformIntegration()->removeScreen(platformScreen->screen());
+QT_WARNING_POP
+
+ // Important to keep this order since the QSceen doesn't own the platform screen
+ delete platformScreen->screen();
+ delete platformScreen;
+}
+
+/*!
+ Should be called whenever the primary screen changes.
+
+ When the screen specified as primary changes, this method will notify
+ QGuiApplication and emit the QGuiApplication::primaryScreenChanged signal.
+ */
+void QWindowSystemInterface::handlePrimaryScreenChanged(QPlatformScreen *newPrimary)
+{
+ QScreen *newPrimaryScreen = newPrimary->screen();
+ int indexOfScreen = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
+ Q_ASSERT(indexOfScreen >= 0);
+ if (indexOfScreen == 0)
+ return;
+
+ QGuiApplicationPrivate::screen_list.swap(0, indexOfScreen);
+ emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
+}
+
void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
{
QWindowSystemInterfacePrivate::ScreenOrientationEvent *e =
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 1dde9130ac..bf98c33a1a 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -233,6 +233,10 @@ public:
static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
// Changes to the screen
+ static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary = false);
+ static void handleScreenRemoved(QPlatformScreen *screen);
+ static void handlePrimaryScreenChanged(QPlatformScreen *newPrimary);
+
static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation);
static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry, const QRect &newAvailableGeometry);
static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY);
diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp
index 763b294660..e0c437be27 100644
--- a/src/plugins/platforms/android/qandroidplatformintegration.cpp
+++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp
@@ -173,7 +173,7 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList &para
qFatal("Could not bind GL_ES API");
m_primaryScreen = new QAndroidPlatformScreen();
- screenAdded(m_primaryScreen);
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
m_primaryScreen->setPhysicalSize(QSize(m_defaultPhysicalSizeWidth, m_defaultPhysicalSizeHeight));
m_primaryScreen->setSize(QSize(m_defaultScreenWidth, m_defaultScreenHeight));
m_primaryScreen->setAvailableGeometry(QRect(0, 0, m_defaultGeometryWidth, m_defaultGeometryHeight));
diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
index 6a7d445e69..e4c90d26af 100644
--- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
+++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp
@@ -53,6 +53,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontext.h>
#include <qpa/qplatforminputcontextfactory_p.h>
+#include <qpa/qwindowsysteminterface.h>
#if QT_CONFIG(tslib)
#include <QtInputSupport/private/qtslib_p.h>
@@ -69,13 +70,13 @@ QBsdFbIntegration::QBsdFbIntegration(const QStringList &paramList)
QBsdFbIntegration::~QBsdFbIntegration()
{
- destroyScreen(m_primaryScreen.take());
+ QWindowSystemInterface::handleScreenRemoved(m_primaryScreen.take());
}
void QBsdFbIntegration::initialize()
{
if (m_primaryScreen->initialize())
- screenAdded(m_primaryScreen.data());
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen.data());
else
qWarning("bsdfb: Failed to initialize screen");
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 6d6c66e242..fb3d05d3e4 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -244,7 +244,7 @@ QCocoaIntegration::~QCocoaIntegration()
// Delete screens in reverse order to avoid crash in case of multiple screens
while (!mScreens.isEmpty()) {
- destroyScreen(mScreens.takeLast());
+ QWindowSystemInterface::handleScreenRemoved(mScreens.takeLast());
}
clearToolbars();
@@ -304,7 +304,7 @@ void QCocoaIntegration::updateScreens()
screen = new QCocoaScreen(i);
mScreens.append(screen);
qCDebug(lcQpaScreen) << "Adding" << screen;
- screenAdded(screen);
+ QWindowSystemInterface::handleScreenAdded(screen);
}
siblings << screen;
}
@@ -321,7 +321,7 @@ void QCocoaIntegration::updateScreens()
// Prevent stale references to NSScreen during destroy
screen->m_screenIndex = -1;
qCDebug(lcQpaScreen) << "Removing" << screen;
- destroyScreen(screen);
+ QWindowSystemInterface::handleScreenRemoved(screen);
}
}
diff --git a/src/plugins/platforms/directfb/qdirectfb_egl.cpp b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
index dad553c890..d3c95f0b65 100644
--- a/src/plugins/platforms/directfb/qdirectfb_egl.cpp
+++ b/src/plugins/platforms/directfb/qdirectfb_egl.cpp
@@ -44,6 +44,7 @@
#include <QtGui/QOpenGLContext>
#include <qpa/qplatformopenglcontext.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtGui/QScreen>
#include <QtEglSupport/private/qeglplatformcontext_p.h>
@@ -248,7 +249,7 @@ QPlatformOpenGLContext *QDirectFbIntegrationEGL::createPlatformOpenGLContext(QOp
void QDirectFbIntegrationEGL::initializeScreen()
{
m_primaryScreen.reset(new QDirectFbScreenEGL(0));
- screenAdded(m_primaryScreen.data());
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen.data());
}
bool QDirectFbIntegrationEGL::hasCapability(QPlatformIntegration::Capability cap) const
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
index cdf340da7a..73e308da53 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
@@ -56,6 +56,7 @@
#include <QtCore/QThread>
#include <QtCore/QAbstractEventDispatcher>
#include <qpa/qplatforminputcontextfactory_p.h>
+#include <qpa/qwindowsysteminterface.h>
QT_BEGIN_NAMESPACE
@@ -113,7 +114,7 @@ void QDirectFbIntegration::initializeDirectFB()
void QDirectFbIntegration::initializeScreen()
{
m_primaryScreen.reset(new QDirectFbScreen(0));
- screenAdded(m_primaryScreen.data());
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen.data());
}
void QDirectFbIntegration::initializeInput()
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index 0a3a37863a..81bad45cd2 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -200,10 +200,8 @@ void QEglFSDeviceIntegration::screenInit()
void QEglFSDeviceIntegration::screenDestroy()
{
QGuiApplication *app = qGuiApp;
- QEglFSIntegration *platformIntegration = static_cast<QEglFSIntegration *>(
- QGuiApplicationPrivate::platformIntegration());
while (!app->screens().isEmpty())
- platformIntegration->removeScreen(app->screens().constLast()->handle());
+ QWindowSystemInterface::handleScreenRemoved(app->screens().constLast()->handle());
}
QSizeF QEglFSDeviceIntegration::physicalScreenSize() const
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
index 8ccb0ef2cd..48469b0f8c 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
@@ -120,16 +120,6 @@ QEglFSIntegration::QEglFSIntegration()
initResources();
}
-void QEglFSIntegration::addScreen(QPlatformScreen *screen, bool isPrimary)
-{
- screenAdded(screen, isPrimary);
-}
-
-void QEglFSIntegration::removeScreen(QPlatformScreen *screen)
-{
- destroyScreen(screen);
-}
-
void QEglFSIntegration::initialize()
{
qt_egl_device_integration()->platformInit();
@@ -147,7 +137,7 @@ void QEglFSIntegration::initialize()
m_vtHandler.reset(new QFbVtHandler);
if (qt_egl_device_integration()->usesDefaultScreen())
- addScreen(new QEglFSScreen(display()));
+ QWindowSystemInterface::handleScreenAdded(new QEglFSScreen(display()));
else
qt_egl_device_integration()->screenInit();
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
index 4b4585d33c..898b322834 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
@@ -103,9 +103,6 @@ public:
QFbVtHandler *vtHandler() { return m_vtHandler.data(); }
- void addScreen(QPlatformScreen *screen, bool isPrimary = false);
- void removeScreen(QPlatformScreen *screen);
-
private:
EGLNativeDisplayType nativeDisplay() const;
void createInputHandlers();
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp
index 5e2708e958..cb7844aff0 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp
@@ -45,6 +45,8 @@
#include <QtEglSupport/private/qeglconvenience_p.h>
#include <QtEglSupport/private/qeglplatformcontext_p.h>
+#include <qpa/qwindowsysteminterface.h>
+
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonParseError>
@@ -80,8 +82,6 @@ bool QEglFSEmulatorIntegration::usesDefaultScreen()
void QEglFSEmulatorIntegration::screenInit()
{
- QEglFSIntegration *integration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration());
-
// Use qgsGetDisplays() call to retrieve the available screens from the Emulator
if (getDisplays) {
QByteArray displaysInfo = getDisplays();
@@ -93,7 +93,7 @@ void QEglFSEmulatorIntegration::screenInit()
QJsonArray screenArray = displaysDocument.array();
for (auto screenValue : screenArray) {
if (screenValue.isObject())
- integration->addScreen(new QEglFSEmulatorScreen(screenValue.toObject()));
+ QWindowSystemInterface::handleScreenAdded(new QEglFSEmulatorScreen(screenValue.toObject()));
}
}
} else {
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
index b073577797..4f0b0d7725 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
@@ -58,7 +58,7 @@ void QEglFSKmsDevice::registerScreen(QPlatformScreen *screen,
QEglFSKmsScreen *s = static_cast<QEglFSKmsScreen *>(screen);
s->setVirtualPosition(virtualPos);
s->setVirtualSiblings(virtualSiblings);
- static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->addScreen(s, isPrimary);
+ QWindowSystemInterface::handleScreenAdded(s, isPrimary);
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/haiku/qhaikuintegration.cpp b/src/plugins/platforms/haiku/qhaikuintegration.cpp
index 8bd2171794..44df6ae8f5 100644
--- a/src/plugins/platforms/haiku/qhaikuintegration.cpp
+++ b/src/plugins/platforms/haiku/qhaikuintegration.cpp
@@ -49,6 +49,7 @@
#include <QCoreApplication>
#include <QFileInfo>
#include <qpa/qplatformwindow.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
#include <Application.h>
@@ -81,12 +82,12 @@ QHaikuIntegration::QHaikuIntegration(const QStringList &parameters)
m_services = new QHaikuServices;
// notify system about available screen
- screenAdded(m_screen);
+ QWindowSystemInterface::handleScreenAdded(m_screen);
}
QHaikuIntegration::~QHaikuIntegration()
{
- destroyScreen(m_screen);
+ QWindowSystemInterface::handleScreenRemoved(m_screen);
m_screen = nullptr;
delete m_services;
diff --git a/src/plugins/platforms/integrity/qintegrityfbintegration.cpp b/src/plugins/platforms/integrity/qintegrityfbintegration.cpp
index ae802bb1fa..3ad31dc562 100644
--- a/src/plugins/platforms/integrity/qintegrityfbintegration.cpp
+++ b/src/plugins/platforms/integrity/qintegrityfbintegration.cpp
@@ -51,7 +51,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
-
+#include <qpa/qwindowsysteminterface.h>
QT_BEGIN_NAMESPACE
@@ -64,13 +64,13 @@ QIntegrityFbIntegration::QIntegrityFbIntegration(const QStringList &paramList)
QIntegrityFbIntegration::~QIntegrityFbIntegration()
{
- destroyScreen(m_primaryScreen);
+ QWindowSystemInterface::handleScreenRemoved(m_primaryScreen);
}
void QIntegrityFbIntegration::initialize()
{
if (m_primaryScreen->initialize())
- screenAdded(m_primaryScreen);
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
else
qWarning("integrityfb: Failed to initialize screen");
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index 818250fcee..eeb44b54d3 100644
--- a/src/plugins/platforms/ios/qiosintegration.h
+++ b/src/plugins/platforms/ios/qiosintegration.h
@@ -92,10 +92,6 @@ public:
QPlatformAccessibility *accessibility() const override;
#endif
- // Called from Objective-C class QIOSScreenTracker, which can't be friended
- void addScreen(QPlatformScreen *screen) { screenAdded(screen); }
- void destroyScreen(QPlatformScreen *screen) { QPlatformIntegration::destroyScreen(screen); }
-
void beep() const override;
static QIOSIntegration *instance();
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index bec8354fcc..9eca0eaad3 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -107,7 +107,7 @@ void QIOSIntegration::initialize()
}
for (UIScreen *screen in screens)
- addScreen(new QIOSScreen(screen));
+ QWindowSystemInterface::handleScreenAdded(new QIOSScreen(screen));
// Depends on a primary screen being present
m_inputContext = new QIOSInputContext;
@@ -143,7 +143,7 @@ QIOSIntegration::~QIOSIntegration()
m_inputContext = 0;
foreach (QScreen *screen, QGuiApplication::screens())
- destroyScreen(screen->handle());
+ QWindowSystemInterface::handleScreenRemoved(screen->handle());
delete m_platformServices;
m_platformServices = 0;
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index 4f753be21a..9aba658479 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -50,6 +50,7 @@
#include <QtGui/private/qwindow_p.h>
#include <private/qcoregraphics_p.h>
+#include <qpa/qwindowsysteminterface.h>
#include <sys/sysctl.h>
@@ -105,10 +106,10 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
+ (void)screenConnected:(NSNotification*)notification
{
- QIOSIntegration *integration = QIOSIntegration::instance();
- Q_ASSERT_X(integration, Q_FUNC_INFO, "Screen connected before QIOSIntegration creation");
+ Q_ASSERT_X(QIOSIntegration::instance(), Q_FUNC_INFO,
+ "Screen connected before QIOSIntegration creation");
- integration->addScreen(new QIOSScreen([notification object]));
+ QWindowSystemInterface::handleScreenAdded(new QIOSScreen([notification object]));
}
+ (void)screenDisconnected:(NSNotification*)notification
@@ -116,8 +117,7 @@ static QIOSScreen* qtPlatformScreenFor(UIScreen *uiScreen)
QIOSScreen *screen = qtPlatformScreenFor([notification object]);
Q_ASSERT_X(screen, Q_FUNC_INFO, "Screen disconnected that we didn't know about");
- QIOSIntegration *integration = QIOSIntegration::instance();
- integration->destroyScreen(screen);
+ QWindowSystemInterface::handleScreenRemoved(screen);
}
+ (void)screenModeChanged:(NSNotification*)notification
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
index 9e38900bcd..68843aa4c5 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
@@ -54,6 +54,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
+#include <qpa/qwindowsysteminterface.h>
#if QT_CONFIG(libinput)
#include <QtInputSupport/private/qlibinputhandler_p.h>
@@ -89,13 +90,13 @@ QLinuxFbIntegration::QLinuxFbIntegration(const QStringList &paramList)
QLinuxFbIntegration::~QLinuxFbIntegration()
{
- destroyScreen(m_primaryScreen);
+ QWindowSystemInterface::handleScreenRemoved(m_primaryScreen);
}
void QLinuxFbIntegration::initialize()
{
if (m_primaryScreen->initialize())
- screenAdded(m_primaryScreen);
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
else
qWarning("linuxfb: Failed to initialize screen");
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index 0c04608fca..f457f69f11 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -43,6 +43,7 @@
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformwindow.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtFontDatabaseSupport/private/qfreetypefontdatabase_p.h>
#if defined(Q_OS_WINRT)
@@ -108,7 +109,7 @@ QMinimalIntegration::QMinimalIntegration(const QStringList &parameters)
mPrimaryScreen->mDepth = 32;
mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
- screenAdded(mPrimaryScreen);
+ QWindowSystemInterface::handleScreenAdded(mPrimaryScreen);
}
QMinimalIntegration::~QMinimalIntegration()
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
index da58441d67..a0d35a80cd 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
@@ -58,6 +58,7 @@
#include <QtGui/QSurfaceFormat>
#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
+#include <qpa/qwindowsysteminterface.h>
// this is where EGL headers are pulled in, make sure it is last
#include "qminimaleglscreen.h"
@@ -90,7 +91,7 @@ protected:
QMinimalEglIntegration::QMinimalEglIntegration()
: mFontDb(new QGenericUnixFontDatabase()), mScreen(new QMinimalEglScreen(EGL_DEFAULT_DISPLAY))
{
- screenAdded(mScreen);
+ QWindowSystemInterface::handleScreenAdded(mScreen);
#ifdef QEGL_EXTRA_DEBUG
qWarning("QMinimalEglIntegration\n");
@@ -99,7 +100,7 @@ QMinimalEglIntegration::QMinimalEglIntegration()
QMinimalEglIntegration::~QMinimalEglIntegration()
{
- destroyScreen(mScreen);
+ QWindowSystemInterface::handleScreenRemoved(mScreen);
delete mFontDb;
}
diff --git a/src/plugins/platforms/mirclient/qmirclientintegration.cpp b/src/plugins/platforms/mirclient/qmirclientintegration.cpp
index eef96ee3de..d2b1dbee0d 100644
--- a/src/plugins/platforms/mirclient/qmirclientintegration.cpp
+++ b/src/plugins/platforms/mirclient/qmirclientintegration.cpp
@@ -58,6 +58,7 @@
#include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#include <qpa/qplatforminputcontext.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtEglSupport/private/qeglconvenience_p.h>
#include <QtEglSupport/private/qeglpbuffer_p.h>
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
@@ -149,12 +150,12 @@ void QMirClientClientIntegration::initialize()
// Init the ScreenObserver
mScreenObserver.reset(new QMirClientScreenObserver(mMirConnection));
connect(mScreenObserver.data(), &QMirClientScreenObserver::screenAdded,
- [this](QMirClientScreen *screen) { this->screenAdded(screen); });
+ [this](QMirClientScreen *screen) { QWindowSystemInterface::handleScreenAdded(screen); });
connect(mScreenObserver.data(), &QMirClientScreenObserver::screenRemoved,
this, &QMirClientClientIntegration::destroyScreen);
Q_FOREACH (auto screen, mScreenObserver->screens()) {
- screenAdded(screen);
+ QWindowSystemInterface::handleScreenAdded(screen);
}
// Initialize input.
@@ -392,7 +393,7 @@ void QMirClientClientIntegration::destroyScreen(QMirClientScreen *screen)
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
delete screen;
#else
- QPlatformIntegration::destroyScreen(screen);
+ QWindowSystemInterface::handleScreenRemoved(screen);
#endif
}
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
index 9815be16a3..ef3b0dd3ff 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp
@@ -63,6 +63,7 @@
#include <qpa/qplatforminputcontextfactory_p.h>
#include <qpa/qplatforminputcontext.h>
#include <qpa/qplatformtheme.h>
+#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformservices.h>
@@ -117,7 +118,7 @@ QOffscreenIntegration::QOffscreenIntegration()
#endif
m_services.reset(new QPlatformServices);
- screenAdded(new QOffscreenScreen);
+ QWindowSystemInterface::handleScreenAdded(new QOffscreenScreen);
}
QOffscreenIntegration::~QOffscreenIntegration()
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
index 4850ca2e45..c5dc40a206 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp
@@ -50,6 +50,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QOpenGLContext>
#include <QtGui/QScreen>
+#include <qpa/qwindowsysteminterface.h>
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
@@ -135,13 +136,3 @@ QPlatformPrinterSupport * QOpenWFDIntegration::printerSupport() const
{
return mPrinterSupport;
}
-
-void QOpenWFDIntegration::addScreen(QOpenWFDScreen *screen)
-{
- screenAdded(screen);
-}
-
-void QOpenWFDIntegration::destroyScreen(QOpenWFDScreen *screen)
-{
- QPlatformIntegration::destroyScreen(screen);
-}
diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.h b/src/plugins/platforms/openwfd/qopenwfdintegration.h
index 1ce1001bed..444aaccaaf 100644
--- a/src/plugins/platforms/openwfd/qopenwfdintegration.h
+++ b/src/plugins/platforms/openwfd/qopenwfdintegration.h
@@ -68,8 +68,6 @@ public:
QPlatformPrinterSupport *printerSupport() const;
- void addScreen(QOpenWFDScreen *screen);
- void destroyScreen(QOpenWFDScreen *screen);
private:
QList<QPlatformScreen *> mScreens;
QList<QOpenWFDDevice *>mDevices;
diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp
index 33254fe83c..34b4439958 100644
--- a/src/plugins/platforms/openwfd/qopenwfdport.cpp
+++ b/src/plugins/platforms/openwfd/qopenwfdport.cpp
@@ -133,7 +133,7 @@ void QOpenWFDPort::attach()
wfdBindPipelineToPort(mDevice->handle(),mPort,mPipeline);
mScreen = new QOpenWFDScreen(this);
- mDevice->integration()->addScreen(mScreen);
+ QWindowSystemInterface::handleScreenAdded(mScreen);
mAttached = true;
}
@@ -145,7 +145,7 @@ void QOpenWFDPort::detach()
mAttached = false;
mOn = false;
- mDevice->integration()->destroyScreen(mScreen);
+ QWindowSystemInterface::handleScreenRemoved(mScreen);
wfdDestroyPipeline(mDevice->handle(),mPipeline);
mPipelineId = WFD_INVALID_PIPELINE_ID;
diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp
index a996e765c4..a45dcabeb7 100644
--- a/src/plugins/platforms/qnx/qqnxintegration.cpp
+++ b/src/plugins/platforms/qnx/qqnxintegration.cpp
@@ -649,7 +649,7 @@ void QQnxIntegration::createDisplay(screen_display_t display, bool isPrimary)
{
QQnxScreen *screen = new QQnxScreen(m_screenContext, display, isPrimary);
m_screens.append(screen);
- screenAdded(screen);
+ QWindowSystemInterface::handleScreenAdded(screen);
screen->adjustOrientation();
QObject::connect(m_screenEventHandler, SIGNAL(newWindowCreated(void*)),
@@ -669,14 +669,14 @@ void QQnxIntegration::removeDisplay(QQnxScreen *screen)
Q_CHECK_PTR(screen);
Q_ASSERT(m_screens.contains(screen));
m_screens.removeAll(screen);
- destroyScreen(screen);
+ QWindowSystemInterface::handleScreenRemoved(screen);
}
void QQnxIntegration::destroyDisplays()
{
qIntegrationDebug();
Q_FOREACH (QQnxScreen *screen, m_screens) {
- QPlatformIntegration::destroyScreen(screen);
+ QWindowSystemInterface::handleScreenRemoved(screen);
}
m_screens.clear();
}
diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp
index 1e2cf6292c..c7a796464a 100644
--- a/src/plugins/platforms/vnc/qvncintegration.cpp
+++ b/src/plugins/platforms/vnc/qvncintegration.cpp
@@ -52,6 +52,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#include <private/qinputdevicemanager_p_p.h>
+#include <qpa/qwindowsysteminterface.h>
#include <QtCore/QRegularExpression>
@@ -77,13 +78,13 @@ QVncIntegration::QVncIntegration(const QStringList &paramList)
QVncIntegration::~QVncIntegration()
{
delete m_server;
- destroyScreen(m_primaryScreen);
+ QWindowSystemInterface::handleScreenRemoved(m_primaryScreen);
}
void QVncIntegration::initialize()
{
if (m_primaryScreen->initialize())
- screenAdded(m_primaryScreen);
+ QWindowSystemInterface::handleScreenAdded(m_primaryScreen);
else
qWarning("vnc: Failed to initialize screen");
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index 1be909f0a0..3829043d07 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -78,7 +78,7 @@ QWasmIntegration::QWasmIntegration()
globalHtml5Integration = this;
updateQScreenAndCanvasRenderSize();
- screenAdded(m_screen);
+ QWindowSystemInterface::handleScreenAdded(m_screen);
emscripten_set_resize_callback(0, (void *)this, 1, uiEvent_cb);
m_eventTranslator = new QWasmEventTranslator;
@@ -93,7 +93,7 @@ QWasmIntegration::QWasmIntegration()
QWasmIntegration::~QWasmIntegration()
{
delete m_compositor;
- destroyScreen(m_screen);
+ QWindowSystemInterface::handleScreenRemoved(m_screen);
delete m_fontDb;
delete m_eventTranslator;
}
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index da86852766..e28b2c2fb3 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -107,9 +107,6 @@ public:
static QWindowsIntegration *instance() { return m_instance; }
- inline void emitScreenAdded(QPlatformScreen *s, bool isPrimary = false) { screenAdded(s, isPrimary); }
- inline void emitDestroyScreen(QPlatformScreen *s) { destroyScreen(s); }
-
unsigned options() const;
void beep() const override;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index a161dc46e9..0520f88935 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -121,7 +121,7 @@ BOOL QT_WIN_CALLBACK monitorEnumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM
QWindowsScreenData data;
if (monitorData(hMonitor, &data)) {
WindowsScreenDataList *result = reinterpret_cast<WindowsScreenDataList *>(p);
- // QPlatformIntegration::screenAdded() documentation specifies that first
+ // QWindowSystemInterface::handleScreenAdded() documentation specifies that first
// added screen will be the primary screen, so order accordingly.
// Note that the side effect of this policy is that there is no way to change primary
// screen reported by Qt, unless we want to delete all existing screens and add them
@@ -521,7 +521,7 @@ void QWindowsScreenManager::removeScreen(int index)
if (movedWindowCount)
QWindowSystemInterface::flushWindowSystemEvents();
}
- QWindowsIntegration::instance()->emitDestroyScreen(m_screens.takeAt(index));
+ QWindowSystemInterface::handleScreenRemoved(m_screens.takeAt(index));
}
/*!
@@ -541,7 +541,7 @@ bool QWindowsScreenManager::handleScreenChanges()
} else {
QWindowsScreen *newScreen = new QWindowsScreen(newData);
m_screens.push_back(newScreen);
- QWindowsIntegration::instance()->emitScreenAdded(newScreen,
+ QWindowSystemInterface::handleScreenAdded(newScreen,
newData.flags & QWindowsScreenData::PrimaryScreen);
qCDebug(lcQpaWindows) << "New Monitor: " << newData;
} // exists
@@ -561,7 +561,7 @@ void QWindowsScreenManager::clearScreens()
{
// Delete screens in reverse order to avoid crash in case of multiple screens
while (!m_screens.isEmpty())
- QWindowsIntegration::instance()->emitDestroyScreen(m_screens.takeLast());
+ QWindowSystemInterface::handleScreenRemoved(m_screens.takeLast());
}
const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const
diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp
index 78cbc3aec3..27d3746933 100644
--- a/src/plugins/platforms/winrt/qwinrtintegration.cpp
+++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp
@@ -133,7 +133,7 @@ QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate)
});
d->inputContext.reset(new QWinRTInputContext(d->mainScreen));
- screenAdded(d->mainScreen);
+ QWindowSystemInterface::handleScreenAdded(d->mainScreen);
d->platformServices = new QWinRTServices;
d->clipboard = new QWinRTClipboard;
#if QT_CONFIG(accessibility)
@@ -154,7 +154,7 @@ QWinRTIntegration::~QWinRTIntegration()
Q_ASSERT_SUCCEEDED(hr);
}
- destroyScreen(d->mainScreen);
+ QWindowSystemInterface::handleScreenRemoved(d->mainScreen);
Windows::Foundation::Uninitialize();
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 29acf0e86d..0d71a5a552 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -146,10 +146,9 @@ QXcbConnection::~QXcbConnection()
if (m_eventQueue)
delete m_eventQueue;
- QXcbIntegration *integration = QXcbIntegration::instance();
// Delete screens in reverse order to avoid crash in case of multiple screens
while (!m_screens.isEmpty())
- integration->destroyScreen(m_screens.takeLast());
+ QWindowSystemInterface::handleScreenRemoved(m_screens.takeLast());
while (!m_virtualDesktops.isEmpty())
delete m_virtualDesktops.takeLast();
diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
index 9aba996bb9..4e631beb25 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp
@@ -44,6 +44,8 @@
#include <QtCore/QString>
#include <QtCore/QList>
+#include <qpa/qwindowsysteminterface.h>
+
#include <xcb/xinerama.h>
void QXcbConnection::xrandrSelectEvents()
@@ -211,7 +213,7 @@ void QXcbConnection::updateScreen(QXcbScreen *screen, const xcb_randr_output_cha
m_screens.swap(0, idx);
}
screen->virtualDesktop()->setPrimaryScreen(screen);
- QXcbIntegration::instance()->setPrimaryScreen(screen);
+ QWindowSystemInterface::handlePrimaryScreenChanged(screen);
}
}
}
@@ -234,7 +236,7 @@ QXcbScreen *QXcbConnection::createScreen(QXcbVirtualDesktop *virtualDesktop,
m_screens.append(screen);
}
virtualDesktop->addScreen(screen);
- QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+ QWindowSystemInterface::handleScreenAdded(screen, screen->isPrimary());
return screen;
}
@@ -261,10 +263,10 @@ void QXcbConnection::destroyScreen(QXcbScreen *screen)
const int idx = m_screens.indexOf(newPrimary);
if (idx > 0)
m_screens.swap(0, idx);
- QXcbIntegration::instance()->setPrimaryScreen(newPrimary);
+ QWindowSystemInterface::handlePrimaryScreenChanged(newPrimary);
}
- QXcbIntegration::instance()->destroyScreen(screen);
+ QWindowSystemInterface::handleScreenRemoved(screen);
}
}
@@ -406,7 +408,7 @@ void QXcbConnection::initializeScreens()
// Push the screens to QGuiApplication
for (QXcbScreen *screen : qAsConst(m_screens)) {
qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ")";
- QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary());
+ QWindowSystemInterface::handleScreenAdded(screen, screen->isPrimary());
}
qCDebug(lcQpaScreen) << "primary output is" << qAsConst(m_screens).first()->name();
diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h
index f13e232291..571726c354 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.h
+++ b/src/plugins/platforms/xcb/qxcbintegration.h
@@ -137,8 +137,6 @@ private:
QScopedPointer<QPlatformServices> m_services;
- friend class QXcbConnection; // access QPlatformIntegration::screenAdded()
-
mutable QByteArray m_wmClass;
const char *m_instanceName;
bool m_canGrab;