diff options
Diffstat (limited to 'src/plugins/platforms')
54 files changed, 273 insertions, 122 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 677a2e2626..c79198d7fe 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -672,11 +672,6 @@ static void updateApplicationState(JNIEnv */*env*/, jobject /*thiz*/, jint state QAndroidEventDispatcherStopper::instance()->goingToStop(true); QCoreApplication::processEvents(); QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState(state)); - { - AndroidDeadlockProtector protector; - if (protector.acquire()) - QWindowSystemInterface::flushWindowSystemEvents(); - } if (state == Qt::ApplicationSuspended) QAndroidEventDispatcherStopper::instance()->stopAll(); } else { diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp index fa768e64d3..97a1f30a35 100644 --- a/src/plugins/platforms/android/qandroidplatformwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp @@ -155,7 +155,7 @@ void QAndroidPlatformWindow::updateStatusBarVisibility() if (!isNonRegularWindow) { if (m_windowState & Qt::WindowFullScreen) QtAndroid::hideStatusBar(); - else if (m_windowState & Qt::WindowMaximized) + else QtAndroid::showStatusBar(); } } diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp index e935d89c9f..9c25076c9c 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp @@ -63,7 +63,7 @@ QBsdFbIntegration::QBsdFbIntegration(const QStringList ¶mList) QBsdFbIntegration::~QBsdFbIntegration() { - destroyScreen(m_primaryScreen.data()); + destroyScreen(m_primaryScreen.take()); } void QBsdFbIntegration::initialize() diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 628357eb39..ccb11f80f1 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -330,6 +330,11 @@ void QCocoaGLContext::updateSurfaceFormat() [pixelFormat release]; + GLint swapInterval = -1; + [m_context getValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; + if (swapInterval >= 0) + m_format.setSwapInterval(swapInterval); + // Restore the original context CGLSetCurrentContext(oldContext); } diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 02ae64a58e..963b29ebbb 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -101,6 +101,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); - (void)setMaskRegion:(const QRegion *)region; - (void)invalidateWindowShadowIfNeeded; - (void)drawRect:(NSRect)dirtyRect; +- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect; - (void)updateGeometry; - (void)notifyWindowStateChanged:(Qt::WindowState)newState; - (void)windowNotification : (NSNotification *) windowNotification; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4aa5bbef03..6f4375b251 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -569,6 +569,18 @@ static bool _q_dontOverrideCtrlLMB = false; if (m_platformWindow->m_drawContentBorderGradient) NSDrawWindowBackground(dirtyRect); + if (m_backingStore) + [self drawBackingStoreUsingCoreGraphics:dirtyRect]; + + [self invalidateWindowShadowIfNeeded]; +} + +// Draws the backing store content to the QNSView using Core Graphics. +// This function assumes that the QNSView is in a configuration that +// supports Core Graphics, such as "classic" mode or layer mode with +// the default layer. +- (void)drawBackingStoreUsingCoreGraphics:(NSRect)dirtyRect +{ if (!m_backingStore) return; @@ -623,8 +635,6 @@ static bool _q_dontOverrideCtrlLMB = false; CGImageRelease(cleanImg); CGImageRelease(subMask); CGImageRelease(bsCGImage); - - [self invalidateWindowShadowIfNeeded]; } - (BOOL) isFlipped diff --git a/src/plugins/platforms/eglfs/api/api.pri b/src/plugins/platforms/eglfs/api/api.pri index 957dee554c..0ea65bd1ff 100644 --- a/src/plugins/platforms/eglfs/api/api.pri +++ b/src/plugins/platforms/eglfs/api/api.pri @@ -3,13 +3,19 @@ SOURCES += $$PWD/qeglfswindow.cpp \ $$PWD/qeglfsscreen.cpp \ $$PWD/qeglfscursor.cpp \ $$PWD/qeglfshooks.cpp \ - $$PWD/qeglfsdeviceintegration.cpp + $$PWD/qeglfsdeviceintegration.cpp \ + $$PWD/qeglfsintegration.cpp \ + $$PWD/qeglfscontext.cpp \ + $$PWD/qeglfsoffscreenwindow.cpp HEADERS += $$PWD/qeglfswindow_p.h \ $$PWD/qeglfsscreen_p.h \ $$PWD/qeglfscursor_p.h \ $$PWD/qeglfshooks_p.h \ $$PWD/qeglfsdeviceintegration_p.h \ - $$PWD/qeglfsglobal.h + $$PWD/qeglfsintegration_p.h \ + $$PWD/qeglfscontext_p.h \ + $$PWD/qeglfsoffscreenwindow_p.h \ + $$PWD/qeglfsglobal_p.h INCLUDEPATH += $$PWD diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp index 8d479873cf..1a33215295 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp @@ -37,12 +37,12 @@ ** ****************************************************************************/ -#include "qeglfsglobal.h" +#include "qeglfsglobal_p.h" #include <QtGui/QSurface> #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglpbuffer_p.h> -#include "qeglfscontext.h" +#include "qeglfscontext_p.h" #include "qeglfswindow_p.h" #include "qeglfshooks_p.h" #include "qeglfscursor_p.h" diff --git a/src/plugins/platforms/eglfs/qeglfscontext.h b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h index 91c5a7910b..65af3a7cee 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.h +++ b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h @@ -40,7 +40,18 @@ #ifndef QEGLFSCONTEXT_H #define QEGLFSCONTEXT_H -#include "qeglfsglobal.h" +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qeglfsglobal_p.h" #include <QtPlatformSupport/private/qeglplatformcontext_p.h> #include <QtCore/QVariant> diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 0040ecd59d..1b3446c4ac 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qeglfscursor_p.h" -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include "qeglfsscreen_p.h" #include <qpa/qwindowsysteminterface.h> diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index 8ccbe4493c..bf6dbc8a21 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qeglfsglobal.h" +#include "qeglfsglobal_p.h" #include <qpa/qplatformcursor.h> #include <qpa/qplatformscreen.h> #include <QtGui/QMatrix4x4> diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 6f65929913..9f05767366 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include "qeglfsdeviceintegration_p.h" -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include "qeglfscursor_p.h" #include "qeglfswindow_p.h" #include "qeglfsscreen_p.h" diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h index 819e4818ab..4335554912 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qeglfsglobal.h" +#include "qeglfsglobal_p.h" #include <qpa/qplatformintegration.h> #include <qpa/qplatformscreen.h> #include <QtCore/QString> diff --git a/src/plugins/platforms/eglfs/api/qeglfsglobal.h b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h index 655ab7eaef..bad5095d21 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsglobal.h +++ b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h @@ -40,6 +40,17 @@ #ifndef QEGLFSGLOBAL_H #define QEGLFSGLOBAL_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include <QtCore/qglobal.h> #include <QtPlatformSupport/private/qt_egl_p.h> diff --git a/src/plugins/platforms/eglfs/api/qeglfshooks_p.h b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h index e379f7a76d..4c3149c7c9 100644 --- a/src/plugins/platforms/eglfs/api/qeglfshooks_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qeglfsglobal.h" +#include "qeglfsglobal_p.h" #include "qeglfsdeviceintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 418ff6119b..4974499e0a 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -51,11 +51,11 @@ #include <qpa/qplatforminputcontextfactory_p.h> #include <private/qgenericunixthemes_p.h> -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include "qeglfswindow_p.h" #include "qeglfshooks_p.h" -#include "qeglfscontext.h" -#include "qeglfsoffscreenwindow.h" +#include "qeglfscontext_p.h" +#include "qeglfsoffscreenwindow_p.h" #include "qeglfscursor_p.h" #include <QtPlatformSupport/private/qeglconvenience_p.h> diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h index 9c5439a22f..1a3a44d441 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h @@ -40,7 +40,18 @@ #ifndef QEGLFSINTEGRATION_H #define QEGLFSINTEGRATION_H -#include "qeglfsglobal.h" +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qeglfsglobal_p.h" #include <QtCore/QVariant> #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp index 0334ac9785..7de5379ae3 100644 --- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include "qeglfsoffscreenwindow.h" +#include "qeglfsoffscreenwindow_p.h" #include "qeglfshooks_p.h" #include <QtGui/QOffscreenSurface> #include <QtPlatformSupport/private/qeglconvenience_p.h> diff --git a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h index 673fa0d729..ec483c64e2 100644 --- a/src/plugins/platforms/eglfs/qeglfsoffscreenwindow.h +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h @@ -40,7 +40,18 @@ #ifndef QEGLFSOFFSCREENWINDOW_H #define QEGLFSOFFSCREENWINDOW_H -#include "qeglfsglobal.h" +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qeglfsglobal_p.h" #include <qpa/qplatformoffscreensurface.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h index daba9fc591..131e619e06 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "qeglfsglobal.h" +#include "qeglfsglobal_p.h" #include <QtCore/QPointer> #include <qpa/qplatformscreen.h> diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h index aea4ed4806..6e752b8f79 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h @@ -51,8 +51,8 @@ // We mean it. // -#include "qeglfsglobal.h" -#include "qeglfsintegration.h" +#include "qeglfsglobal_p.h" +#include "qeglfsintegration_p.h" #include "qeglfsscreen_p.h" #include <qpa/qplatformwindow.h> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro index d65e136a96..7f1e7b9f59 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro @@ -2,7 +2,7 @@ TARGET = qeglfs-brcm-integration QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private -INCLUDEPATH += $$PWD/../.. +INCLUDEPATH += $$PWD/../../api CONFIG += egl LIBS += -lbcm_host diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro index 70ff054172..10571dc978 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro @@ -6,7 +6,7 @@ load(qt_plugin) QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private -INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support +INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp index 99f6cfb0ca..3a220ec942 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp @@ -42,7 +42,7 @@ #include "qeglfskmsgbmdevice.h" #include "qeglfskmsgbmscreen.h" -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include <QtCore/QLoggingCategory> #include <QtCore/private/qcore_unix_p.h> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index dde386fc57..75ff3ac749 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -42,7 +42,7 @@ #include "qeglfskmsgbmscreen.h" #include "qeglfskmsgbmdevice.h" #include "qeglfskmsgbmcursor.h" -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include <QtCore/QLoggingCategory> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro index 5f47b98369..582982df76 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro @@ -2,7 +2,7 @@ TARGET = qeglfs-kms-egldevice-integration QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private eglfs_kms_support-private -INCLUDEPATH += $$PWD/../.. $$PWD/../eglfs_kms_support +INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro index 464c64539f..f88a7c847e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro @@ -4,7 +4,7 @@ load(qt_module) QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private -INCLUDEPATH += $$PWD/../.. +INCLUDEPATH += $$PWD/../../api # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 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 5944e8d51f..bf96a7d683 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -42,7 +42,7 @@ #include "qeglfskmsdevice.h" #include "qeglfskmsscreen.h" -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include <QtCore/QLoggingCategory> #include <QtCore/private/qcore_unix_p.h> @@ -159,7 +159,9 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode) return true; } -QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex) +QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resources, + drmModeConnectorPtr connector, + VirtualDesktopInfo *vinfo) { const QByteArray connectorName = nameForConnector(connector); @@ -192,8 +194,16 @@ QEglFSKmsScreen *QEglFSKmsDevice::createScreenForConnector(drmModeResPtr resourc qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData()); configuration = OutputConfigPreferred; } - if (virtualIndex) - *virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt(); + if (vinfo) { + *vinfo = VirtualDesktopInfo(); + vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt(); + if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) { + const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray(); + const QByteArrayList vposComp = vpos.split(','); + if (vposComp.count() == 2) + vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt()); + } + } const uint32_t crtc_id = resources->crtcs[crtc]; @@ -357,22 +367,24 @@ QEglFSKmsDevice::~QEglFSKmsDevice() struct OrderedScreen { - OrderedScreen() : screen(nullptr), index(-1) { } - OrderedScreen(QEglFSKmsScreen *screen, int index) : screen(screen), index(index) { } + OrderedScreen() : screen(nullptr) { } + OrderedScreen(QEglFSKmsScreen *screen, const QEglFSKmsDevice::VirtualDesktopInfo &vinfo) + : screen(screen), vinfo(vinfo) { } QEglFSKmsScreen *screen; - int index; + QEglFSKmsDevice::VirtualDesktopInfo vinfo; }; QDebug operator<<(QDebug dbg, const OrderedScreen &s) { QDebugStateSaver saver(dbg); - dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.index << ")"; + dbg.nospace() << "OrderedScreen(" << s.screen << " : " << s.vinfo.virtualIndex + << " / " << s.vinfo.virtualPos << ")"; return dbg; } static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b) { - return a.index < b.index; + return a.vinfo.virtualIndex < b.vinfo.virtualIndex; } void QEglFSKmsDevice::createScreens() @@ -390,10 +402,10 @@ void QEglFSKmsDevice::createScreens() if (!connector) continue; - int virtualIndex; - QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &virtualIndex); + VirtualDesktopInfo vinfo; + QEglFSKmsScreen *screen = createScreenForConnector(resources, connector, &vinfo); if (screen) - screens.append(OrderedScreen(screen, virtualIndex)); + screens.append(OrderedScreen(screen, vinfo)); drmModeFreeConnector(connector); } @@ -411,11 +423,15 @@ void QEglFSKmsDevice::createScreens() for (const OrderedScreen &orderedScreen : screens) { QEglFSKmsScreen *s = orderedScreen.screen; // set up a horizontal or vertical virtual desktop - s->setVirtualPosition(pos); - if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) - pos.ry() += s->geometry().height(); - else - pos.rx() += s->geometry().width(); + if (orderedScreen.vinfo.virtualPos.isNull()) { + s->setVirtualPosition(pos); + if (m_integration->virtualDesktopLayout() == QEglFSKmsIntegration::VirtualDesktopLayoutVertical) + pos.ry() += s->geometry().height(); + else + pos.rx() += s->geometry().width(); + } else { + s->setVirtualPosition(orderedScreen.vinfo.virtualPos); + } qCDebug(qLcEglfsKmsDebug) << "Adding screen" << s << "to QPA with geometry" << s->geometry(); // The order in qguiapp's screens list will match the order set by // virtualIndex. This is not only handy but also required since for instance diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h index 4aad2e0143..3e7ac7e3f0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h @@ -53,6 +53,12 @@ QT_BEGIN_NAMESPACE class Q_EGLFS_EXPORT QEglFSKmsDevice { public: + struct VirtualDesktopInfo { + VirtualDesktopInfo() : virtualIndex(0) { } + int virtualIndex; + QPoint virtualPos; + }; + QEglFSKmsDevice(QEglFSKmsIntegration *integration, const QString &path); virtual ~QEglFSKmsDevice(); @@ -79,7 +85,9 @@ protected: quint32 m_connector_allocator; int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector); - QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, drmModeConnectorPtr connector, int *virtualIndex); + QEglFSKmsScreen *createScreenForConnector(drmModeResPtr resources, + drmModeConnectorPtr connector, + VirtualDesktopInfo *vinfo); drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name); static void pageFlipHandler(int fd, diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index f690cd668e..e4b6c67f28 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -41,7 +41,7 @@ #include "qeglfskmsscreen.h" #include "qeglfskmsdevice.h" -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" #include <QtCore/QLoggingCategory> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro index 6e32ca26d0..e72f5bdd14 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro @@ -5,7 +5,7 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 -INCLUDEPATH += $$PWD/../.. +INCLUDEPATH += $$PWD/../../api CONFIG += egl QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro index 16880535e3..364812ec60 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro @@ -2,7 +2,7 @@ TARGET = qeglfs-viv-integration QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private -INCLUDEPATH += $$PWD/../.. +INCLUDEPATH += $$PWD/../../api CONFIG += egl DEFINES += LINUX=1 EGL_API_FB=1 QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro index 374c5bba6b..ccdf20b417 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro @@ -2,7 +2,7 @@ TARGET = qeglfs-viv-wl-integration QT += core-private gui-private platformsupport-private eglfsdeviceintegration-private -INCLUDEPATH += $$PWD/../.. +INCLUDEPATH += $$PWD/../../api CONFIG += egl DEFINES += LINUX=1 EGL_API_FB=1 QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index 10af57e487..51a026e2cf 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -5,7 +5,7 @@ QT += core-private gui-private platformsupport-private eglfsdeviceintegration-pr # Avoid X11 header collision, use generic EGL native types DEFINES += QT_EGL_NO_X11 -INCLUDEPATH += $$PWD/../.. +INCLUDEPATH += $$PWD/../../api CONFIG += egl QMAKE_USE += xcb_xlib diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro index 90b8a9fb32..d8adc13226 100644 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ b/src/plugins/platforms/eglfs/eglfs-plugin.pro @@ -6,6 +6,8 @@ SOURCES += $$PWD/qeglfsmain.cpp OTHER_FILES += $$PWD/eglfs.json +INCLUDEPATH += $$PWD/api + PLUGIN_TYPE = platforms PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin !equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro index eb0ce73118..15a825a7b0 100644 --- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro +++ b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro @@ -1,7 +1,8 @@ # The device integration plugin base class has to live in a shared library, # placing it into a static lib like platformsupport is not sufficient since we # have to keep the QObject magic like qobject_cast working. -# Hence this header-less, private-only module. +# Hence this private-only module. +# By having _p headers, it also enables developing out-of-tree integration plugins. TARGET = QtEglFSDeviceIntegration CONFIG += internal_module @@ -15,20 +16,10 @@ DEFINES += QT_EGL_NO_X11 DEFINES += QT_BUILD_EGL_DEVICE_LIB -SOURCES += $$PWD/qeglfsintegration.cpp \ - $$PWD/qeglfscontext.cpp \ - $$PWD/qeglfsoffscreenwindow.cpp \ - -HEADERS += $$PWD/qeglfsintegration.h \ - $$PWD/qeglfscontext.h \ - $$PWD/qeglfsoffscreenwindow.h \ - include($$PWD/api/api.pri) QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF -INCLUDEPATH += $$PWD - !isEmpty(EGLFS_PLATFORM_HOOKS_SOURCES) { HEADERS += $$EGLFS_PLATFORM_HOOKS_HEADERS SOURCES += $$EGLFS_PLATFORM_HOOKS_SOURCES diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp index 50279ad110..2885d397c6 100644 --- a/src/plugins/platforms/eglfs/qeglfsmain.cpp +++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp @@ -38,7 +38,7 @@ ****************************************************************************/ #include <qpa/qplatformintegrationplugin.h> -#include "qeglfsintegration.h" +#include "qeglfsintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm index 6165e480dc..02deab59b5 100644 --- a/src/plugins/platforms/ios/qiosmenu.mm +++ b/src/plugins/platforms/ios/qiosmenu.mm @@ -321,7 +321,7 @@ QIOSMenu::QIOSMenu() : QPlatformMenu() , m_tag(0) , m_enabled(true) - , m_visible(true) + , m_visible(false) , m_text(QString()) , m_menuType(DefaultMenu) , m_effectiveMenuType(DefaultMenu) @@ -414,7 +414,7 @@ void QIOSMenu::handleItemSelected(QIOSMenuItem *menuItem) void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) { - if (m_currentMenu == this || !m_visible || !m_enabled || !parentWindow) + if (m_currentMenu == this || !parentWindow) return; emit aboutToShow(); @@ -441,6 +441,8 @@ void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, c toggleShowUsingUIPickerView(true); break; } + + m_visible = true; } void QIOSMenu::dismiss() @@ -462,6 +464,7 @@ void QIOSMenu::dismiss() } m_currentMenu = 0; + m_visible = false; } void QIOSMenu::toggleShowUsingUIMenuController(bool show) diff --git a/src/plugins/platforms/ios/qiosmessagedialog.mm b/src/plugins/platforms/ios/qiosmessagedialog.mm index 1d078be0b9..4f0c667861 100644 --- a/src/plugins/platforms/ios/qiosmessagedialog.mm +++ b/src/plugins/platforms/ios/qiosmessagedialog.mm @@ -109,7 +109,7 @@ bool QIOSMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality win Q_UNUSED(windowFlags); if (m_alertController // Ensure that the dialog is not showing already || !options() // Some message dialogs don't have options (QErrorMessage) - || windowModality != Qt::ApplicationModal // We can only do app modal dialogs + || windowModality == Qt::NonModal // We can only do modal dialogs || QOperatingSystemVersion::current() < QOperatingSystemVersion(QOperatingSystemVersion::IOS, 8)) // API limitation return false; diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm index 5e21011da7..462da0a978 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.mm +++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm @@ -299,7 +299,11 @@ static void executeBlockWithoutAnimation(Block block) // ------------------------------------------------------------------------- +#if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_10_0) +@interface QIOSHandleLayer : CALayer <CAAnimationDelegate> { +#else @interface QIOSHandleLayer : CALayer { +#endif CALayer *_handleCursorLayer; CALayer *_handleKnobLayer; Qt::Edge _selectionEdge; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 72eb5e27a0..0478c5b8c8 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -229,6 +229,10 @@ @implementation QIOSViewController +@synthesize prefersStatusBarHidden; +@synthesize preferredStatusBarUpdateAnimation; +@synthesize preferredStatusBarStyle; + - (id)initWithQIOSScreen:(QT_PREPEND_NAMESPACE(QIOSScreen) *)screen { if (self = [self init]) { diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index ae14d87a30..8ff0dfbd5f 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -93,7 +93,7 @@ QIOSWindow::~QIOSWindow() // practice this doesn't seem to happen when removing the view from its superview. To ensure that // Qt's internal state for touch and mouse handling is kept consistent, we therefor have to force // cancellation of all touch events. - [m_view touchesCancelled:0 withEvent:0]; + [m_view touchesCancelled:[NSSet set] withEvent:0]; clearAccessibleCache(); m_view->m_qioswindow = 0; diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index 133269a0de..25bfa2ad90 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -430,7 +430,8 @@ // We do this by assuming that there are no cases where a // sub-set of the active touch events are intentionally cancelled. - if (touches && (static_cast<NSInteger>([touches count]) != m_activeTouches.count())) + NSInteger count = static_cast<NSInteger>([touches count]); + if (count != 0 && count != m_activeTouches.count()) qWarning("Subset of active touches cancelled by UIKit"); m_activeTouches.clear(); diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 9d38742d6f..7229d7d2a8 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -112,7 +112,7 @@ static inline QQnxIntegration::Options parseOptions(const QStringList ¶mList options |= QQnxIntegration::FullScreenApplication; } - if (!paramList.contains(QLatin1String("flush-screen-context"))) { + if (paramList.contains(QLatin1String("flush-screen-context"))) { options |= QQnxIntegration::AlwaysFlushScreenContext; } diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 3fa511e6df..b7264d0973 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -49,6 +49,17 @@ #include <screen/screen.h> +// For pre-7.0 SDPs, map some screen property names to the old +// names. +#include <sys/neutrino.h> +#if _NTO_VERSION < 700 +const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS; +const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS; +const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS; +const int SCREEN_PROPERTY_SCAN = SCREEN_PROPERTY_KEY_SCAN; +const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM; +#endif + QT_BEGIN_NAMESPACE class QQnxWindow; diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 42651732c2..beda6e1a49 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -239,20 +239,20 @@ void QQnxScreenEventHandler::handleKeyboardEvent(screen_event_t event) { // get flags of key event int flags; - Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_FLAGS, &flags), + Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &flags), "Failed to query event flags"); // get key code int sym; - Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SYM, &sym), + Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &sym), "Failed to query event sym"); int modifiers; - Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_MODIFIERS, &modifiers), + Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_MODIFIERS, &modifiers), "Failed to query event modifieres"); int scan; - Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_KEY_SCAN, &scan), + Q_SCREEN_CHECKERROR(screen_get_event_property_iv(event, SCREEN_PROPERTY_SCAN, &scan), "Failed to query event scan"); int cap; @@ -594,7 +594,7 @@ void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event) qFatal("QQnx: failed to query window property, errno=%d", errno); switch (property) { - case SCREEN_PROPERTY_KEYBOARD_FOCUS: + case SCREEN_PROPERTY_FOCUS: handleKeyboardFocusPropertyEvent(window); break; default: @@ -607,7 +607,7 @@ void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t wi { errno = 0; int focus = 0; - if (Q_UNLIKELY(window && screen_get_window_property_iv(window, SCREEN_PROPERTY_KEYBOARD_FOCUS, &focus) != 0)) + if (Q_UNLIKELY(window && screen_get_window_property_iv(window, SCREEN_PROPERTY_FOCUS, &focus) != 0)) qFatal("QQnx: failed to query keyboard focus property, errno=%d", errno); QWindow *focusWindow = QQnxIntegration::window(window); diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index f4e6ca9804..7b3a5ec70c 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -581,7 +581,7 @@ void QQnxWindow::setFocus(screen_window_t newFocusWindow) screen_get_window_property_pv(nativeHandle(), SCREEN_PROPERTY_GROUP, reinterpret_cast<void**>(&screenGroup)); if (screenGroup) { - screen_set_group_property_pv(screenGroup, SCREEN_PROPERTY_KEYBOARD_FOCUS, + screen_set_group_property_pv(screenGroup, SCREEN_PROPERTY_FOCUS, reinterpret_cast<void**>(&newFocusWindow)); } } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 9f2d0c8a33..d667036e8a 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -908,7 +908,7 @@ static FontNames getCanonicalFontNames(const uchar *table, quint32 bytes) } // namespace -QString getEnglishName(const QString &familyName) +QString getEnglishName(const QString &familyName, bool includeStyle = false) { QString i18n_name; QString faceName = familyName; @@ -946,7 +946,12 @@ QString getEnglishName(const QString &familyName) if ( bytes == GDI_ERROR ) goto error; - i18n_name = getCanonicalFontNames(table, bytes).name; + { + const FontNames names = getCanonicalFontNames(table, bytes); + i18n_name = names.name; + if (includeStyle) + i18n_name += QLatin1Char(' ') + names.style; + } error: delete [] table; SelectObject( hdc, oldobj ); @@ -1252,6 +1257,7 @@ QT_WARNING_POP request.pixelSize = pixelSize; request.styleStrategy = QFont::PreferMatch; request.hintingPreference = hintingPreference; + request.stretch = QFont::Unstretched; fontEngine = QWindowsFontDatabase::createEngine(request, QWindowsContext::instance()->defaultDPI(), diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 4d8966f934..f7c8dbdf23 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -102,7 +102,7 @@ static FontFile * createFontFile(const QString &fileName, int index) } extern bool localizedName(const QString &name); -extern QString getEnglishName(const QString &familyName); +extern QString getEnglishName(const QString &familyName, bool includeStyle = false); namespace { struct FontKey @@ -235,9 +235,19 @@ static bool addFontToDatabase(const QString &faceName, } int index = 0; - const FontKey *key = findFontKey(faceName, &index); + const FontKey *key = findFontKey(fullName, &index); if (!key) { - key = findFontKey(fullName, &index); + // On non-English locales, the styles of the font may be localized in enumeration, but + // not in the registry. + QLocale systemLocale = QLocale::system(); + if (systemLocale.language() != QLocale::C + && systemLocale.language() != QLocale::English + && styleName != QLatin1String("Italic") + && styleName != QLatin1String("Bold")) { + key = findFontKey(getEnglishName(fullName, true), &index); + } + if (!key) + key = findFontKey(faceName, &index); if (!key && !registerAlias && englishName.isEmpty() && localizedName(faceName)) englishName = getEnglishName(faceName); if (!key && !englishName.isEmpty()) diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index 9236de58a1..e8e869c04f 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -828,7 +828,7 @@ void QWinRTScreen::addWindow(QWindow *window) } handleExpose(); - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); #if _MSC_VER >= 1900 && !defined(QT_NO_DRAGANDDROP) QWinRTDrag::instance()->setDropTarget(window); @@ -848,7 +848,7 @@ void QWinRTScreen::removeWindow(QWindow *window) if (wasTopWindow && type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool) QWindowSystemInterface::handleWindowActivated(Q_NULLPTR, Qt::OtherFocusReason); handleExpose(); - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); #if _MSC_VER >= 1900 && !defined(QT_NO_DRAGANDDROP) if (wasTopWindow) QWinRTDrag::instance()->setDropTarget(topWindow()); @@ -1157,6 +1157,12 @@ HRESULT QWinRTScreen::onPointerUpdated(ICoreWindow *, IPointerEventArgs *args) properties->get_IsLeftButtonPressed(&isPressed); // IsInContact not reliable on phone #endif + // Devices like the Hololens set a static pressure of 0.5 independent + // of the pressed state. In those cases we need to synthesize the + // pressure value. To our knowledge this does not apply to pens + if (pointerDeviceType == PointerDeviceType_Touch && pressure == 0.5f) + pressure = isPressed ? 1. : 0.; + const QRectF areaRect(area.X * d->scaleFactor, area.Y * d->scaleFactor, area.Width * d->scaleFactor, area.Height * d->scaleFactor); diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index fbf3acc54b..4915bb1b11 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -992,6 +992,9 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e } else { dropData = platformDropData(); supported_drop_actions = accepted_drop_action; + + // Drop coming from another app? Update keyboard modifiers. + QGuiApplicationPrivate::modifier_buttons = QGuiApplication::queryKeyboardModifiers(); } if (!dropData) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 07932ceeb8..a5aff7f11f 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -748,8 +748,7 @@ void QXcbKeyboard::updateKeymap() // update xkb state object xkb_state_unref(xkb_state); xkb_state = new_state; - if (!connection()->hasXKB()) - updateXKBMods(); + updateXKBMods(); checkForLatinLayout(); } @@ -774,32 +773,37 @@ void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) } #endif +void QXcbKeyboard::updateXKBStateFromState(struct xkb_state *kb_state, quint16 state) +{ + const quint32 modsDepressed = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_DEPRESSED); + const quint32 modsLatched = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LATCHED); + const quint32 modsLocked = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LOCKED); + const quint32 xkbMask = xkbModMask(state); + + const quint32 latched = modsLatched & xkbMask; + const quint32 locked = modsLocked & xkbMask; + quint32 depressed = modsDepressed & xkbMask; + // set modifiers in depressed if they don't appear in any of the final masks + depressed |= ~(depressed | latched | locked) & xkbMask; + + const xkb_state_component newState + = xkb_state_update_mask(kb_state, + depressed, + latched, + locked, + 0, + 0, + (state >> 13) & 3); // bits 13 and 14 report the state keyboard group + + if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) { + //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)"); + } +} + void QXcbKeyboard::updateXKBStateFromCore(quint16 state) { if (m_config && !connection()->hasXKB()) { - const quint32 modsDepressed = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED); - const quint32 modsLatched = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED); - const quint32 modsLocked = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED); - const quint32 xkbMask = xkbModMask(state); - - const quint32 latched = modsLatched & xkbMask; - const quint32 locked = modsLocked & xkbMask; - quint32 depressed = modsDepressed & xkbMask; - // set modifiers in depressed if they don't appear in any of the final masks - depressed |= ~(depressed | latched | locked) & xkbMask; - - const xkb_state_component newState - = xkb_state_update_mask(xkb_state, - depressed, - latched, - locked, - 0, - 0, - (state >> 13) & 3); // bits 13 and 14 report the state keyboard group - - if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) { - //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)"); - } + updateXKBStateFromState(xkb_state, state); } } @@ -1393,10 +1397,11 @@ void QXcbKeyboard::resolveMaskConflicts() class KeyChecker { public: - KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time) + KeyChecker(xcb_window_t window, xcb_keycode_t code, xcb_timestamp_t time, quint16 state) : m_window(window) , m_code(code) , m_time(time) + , m_state(state) , m_error(false) , m_release(true) { @@ -1413,7 +1418,7 @@ public: xcb_key_press_event_t *event = (xcb_key_press_event_t *)ev; - if (event->event != m_window || event->detail != m_code) { + if (event->event != m_window || event->detail != m_code || event->state != m_state) { m_error = true; return false; } @@ -1441,6 +1446,7 @@ private: xcb_window_t m_window; xcb_keycode_t m_code; xcb_timestamp_t m_time; + quint16 m_state; bool m_error; bool m_release; @@ -1461,7 +1467,16 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, if (type == QEvent::KeyPress) targetWindow->updateNetWmUserTime(time); - xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code); + // Have a temporary keyboard state filled in from state + // this way we allow for synthetic events to have different state + // from the current state i.e. you can have Alt+Ctrl pressed + // and receive a synthetic key event that has neither Alt nor Ctrl pressed + struct xkb_state *kb_state = xkb_state_new(xkb_keymap); + if (!kb_state) + return; + updateXKBStateFromState(kb_state, state); + + xcb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code); QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); QMetaMethod method; @@ -1480,11 +1495,13 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, Q_ARG(uint, code), Q_ARG(uint, state), Q_ARG(bool, type == QEvent::KeyPress)); - if (retval) + if (retval) { + xkb_state_unref(kb_state); return; + } } - QString string = lookupString(xkb_state, code); + QString string = lookupString(kb_state, code); // Ιf control modifier is set we should prefer latin character, this is // used for standard shortcuts in checks like "key == QKeySequence::Copy", @@ -1505,7 +1522,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, } } else { // look ahead for auto-repeat - KeyChecker checker(source->xcb_window(), code, time); + KeyChecker checker(source->xcb_window(), code, time, state); xcb_generic_event_t *event = connection()->checkEvent(checker); if (event) { isAutoRepeat = true; @@ -1555,6 +1572,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat); } + xkb_state_unref(kb_state); } QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 817b57ff5b..dfd2926435 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -104,6 +104,8 @@ protected: void checkForLatinLayout(); private: + void updateXKBStateFromState(struct xkb_state *kb_state, quint16 state); + bool m_config; xcb_keycode_t m_autorepeat_code; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 51390bfdae..c81858c408 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2541,8 +2541,13 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev if (reply && reply->format == 32 && reply->type == atom(QXcbAtom::WM_STATE)) { const quint32 *data = (const quint32 *)xcb_get_property_value(reply); - if (reply->length != 0 && XCB_WM_STATE_ICONIC == data[0]) - newState = Qt::WindowMinimized; + if (reply->length != 0) { + if (data[0] == XCB_WM_STATE_ICONIC + || (data[0] == XCB_WM_STATE_WITHDRAWN + && m_lastWindowStateEvent == Qt::WindowMinimized)) { + newState = Qt::WindowMinimized; + } + } } free(reply); } else { // _NET_WM_STATE can't change minimized state |