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>bb10
parent
dc75337447
commit
01e1df90a7
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ private:
|
|||
friend class QPlatformIntegration;
|
||||
friend class QPlatformScreen;
|
||||
friend class QHighDpiScaling;
|
||||
friend class QWindowSystemInterface;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶
|
|||
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));
|
||||
|
|
|
|||
|
|
@ -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 ¶mList)
|
|||
|
||||
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ¶meters)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -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 ¶mList)
|
|||
|
||||
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ¶mList)
|
|||
|
||||
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ¶meters)
|
|||
mPrimaryScreen->mDepth = 32;
|
||||
mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
|
||||
|
||||
screenAdded(mPrimaryScreen);
|
||||
QWindowSystemInterface::handleScreenAdded(mPrimaryScreen);
|
||||
}
|
||||
|
||||
QMinimalIntegration::~QMinimalIntegration()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@ public:
|
|||
|
||||
QPlatformPrinterSupport *printerSupport() const;
|
||||
|
||||
void addScreen(QOpenWFDScreen *screen);
|
||||
void destroyScreen(QOpenWFDScreen *screen);
|
||||
private:
|
||||
QList<QPlatformScreen *> mScreens;
|
||||
QList<QOpenWFDDevice *>mDevices;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ¶mList)
|
|||
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue