diff options
Diffstat (limited to 'src/plugins/platforms')
30 files changed, 214 insertions, 159 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 19ab051162..cd40b7eec2 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -443,6 +443,11 @@ static void *startMainMethod(void */*data*/) if (m_applicationClass) QJNIObjectPrivate::callStaticMethod<void>(m_applicationClass, "quitApp", "()V"); + // All attached threads should be detached before returning from this function. + JavaVM *vm = QtAndroidPrivate::javaVM(); + if (vm != 0) + vm->DetachCurrentThread(); + return 0; } diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp index 9b60ab291c..be1a3d7bdf 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.cpp @@ -45,26 +45,20 @@ QString QAndroidPlatformFontDatabase::fontDir() const void QAndroidPlatformFontDatabase::populateFontDatabase() { QString fontpath = fontDir(); + QDir dir(fontpath); - if (!QFile::exists(fontpath)) { + if (!dir.exists()) { qFatal("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", qPrintable(fontpath)); } - QDir dir(fontpath); - QList<QFileInfo> entries = dir.entryInfoList(QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.otf"), QDir::Files); - for (int i = 0; i < int(entries.count()); ++i) { - const QByteArray file = QFile::encodeName(entries.at(i).absoluteFilePath()); - QSupportedWritingSystems supportedWritingSystems; - QStringList families = addTTFile(QByteArray(), file, &supportedWritingSystems); + QStringList nameFilters; + nameFilters << QLatin1String("*.ttf") + << QLatin1String("*.otf"); - extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem); - for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { - if (i == QFontDatabase::Any || supportedWritingSystems.supported(QFontDatabase::WritingSystem(i))) { - QChar::Script script = QChar::Script(qt_script_for_writing_system(QFontDatabase::WritingSystem(i))); - m_fallbacks[script] += families; - } - } + foreach (const QFileInfo &fi, dir.entryInfoList(nameFilters, QDir::Files)) { + const QByteArray file = QFile::encodeName(fi.absoluteFilePath()); + QBasicFontDatabase::addTTFile(QByteArray(), file); } } @@ -73,15 +67,16 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami QFont::StyleHint styleHint, QChar::Script script) const { - Q_UNUSED(family); - Q_UNUSED(style); - + QStringList result; if (styleHint == QFont::Monospace || styleHint == QFont::Courier) - return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script]; + result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";")); else if (styleHint == QFont::Serif) - return QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";") + m_fallbacks[script]; + result.append(QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";")); + else + result.append(QString(qgetenv("QT_ANDROID_FONTS")).split(";")); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); - return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script]; + return result; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/qandroidplatformfontdatabase.h b/src/plugins/platforms/android/qandroidplatformfontdatabase.h index 45de47a58c..89a9ed8bc0 100644 --- a/src/plugins/platforms/android/qandroidplatformfontdatabase.h +++ b/src/plugins/platforms/android/qandroidplatformfontdatabase.h @@ -47,9 +47,6 @@ public: QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; - -private: - QHash<QChar::Script, QStringList> m_fallbacks; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 4309702fd5..edcbd16dca 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1435,8 +1435,12 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (eventType == QEvent::KeyPress) { - if (m_composingText.isEmpty()) - m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1); + if (m_composingText.isEmpty()) { + QKeyEvent override(QEvent::ShortcutOverride, keyCode, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); + override.setTimestamp(timestamp); + m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutOverrideEvent(focusWindow, &override); + } QObject *fo = QGuiApplication::focusObject(); if (m_sendKeyEvent && fo) { diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index e550efe7c3..ec678fee44 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -50,15 +50,15 @@ public: QIOSContext(QOpenGLContext *context); ~QIOSContext(); - QSurfaceFormat format() const; + QSurfaceFormat format() const Q_DECL_OVERRIDE; - void swapBuffers(QPlatformSurface *surface); + void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); + bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE; + void doneCurrent() Q_DECL_OVERRIDE; - GLuint defaultFramebufferObject(QPlatformSurface *) const; - QFunctionPointer getProcAddress(const QByteArray &procName); + GLuint defaultFramebufferObject(QPlatformSurface *) const Q_DECL_OVERRIDE; + QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE; bool isSharing() const Q_DECL_OVERRIDE; bool isValid() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm index f0b6afce2d..761a89c989 100644 --- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm @@ -304,7 +304,7 @@ public: return g_iteratorCurrentUrl.localData(); } - QFileInfo currentFileInfo() const + QFileInfo currentFileInfo() const Q_DECL_OVERRIDE { return QFileInfo(currentFileName()); } diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index 0fe318dce7..7d23fe1d62 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -54,26 +54,26 @@ public: QIOSIntegration(); ~QIOSIntegration(); - bool hasCapability(Capability cap) const; + bool hasCapability(Capability cap) const Q_DECL_OVERRIDE; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; + QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - QPlatformInputContext *inputContext() const; + QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; + QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; + QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; QPlatformServices *services() const Q_DECL_OVERRIDE; - QVariant styleHint(StyleHint hint) const; + QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; - QStringList themeNames() const; - QPlatformTheme *createPlatformTheme(const QString &name) const; + QStringList themeNames() const Q_DECL_OVERRIDE; + QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; - QAbstractEventDispatcher *createEventDispatcher() const; - QPlatformNativeInterface *nativeInterface() const; + QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; + QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE; QTouchDevice *touchDevice(); QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; @@ -86,7 +86,7 @@ public: // -- QPlatformNativeInterface -- - void *nativeResourceForWindow(const QByteArray &resource, QWindow *window); + void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE; void setDebugWindowManagement(bool); bool debugWindowManagement() const; diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index b4050b8f62..eaff0daf19 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -81,7 +81,7 @@ QIOSIntegration::QIOSIntegration() // QPlatformBackingStore. qApp->setAttribute(Qt::AA_ShareOpenGLContexts, true); // And that context must match the format used for the backingstore's context. - QSurfaceFormat fmt; + QSurfaceFormat fmt = QSurfaceFormat::defaultFormat(); fmt.setDepthBufferSize(16); fmt.setStencilBufferSize(8); QSurfaceFormat::setDefaultFormat(fmt); diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h index 15f200bb27..4fa0416df7 100644 --- a/src/plugins/platforms/ios/qiosmenu.h +++ b/src/plugins/platforms/ios/qiosmenu.h @@ -112,7 +112,7 @@ public: static id menuActionTarget() { return m_currentMenu ? m_currentMenu->m_menuController : 0; } protected: - bool eventFilter(QObject *obj, QEvent *event); + bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE; private: quintptr m_tag; diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h index a638210c00..a0aa922a31 100644 --- a/src/plugins/platforms/ios/qiosscreen.h +++ b/src/plugins/platforms/ios/qiosscreen.h @@ -50,17 +50,17 @@ public: QIOSScreen(UIScreen *screen); ~QIOSScreen(); - QRect geometry() const; - QRect availableGeometry() const; - int depth() const; - QImage::Format format() const; - QSizeF physicalSize() const; - QDpi logicalDpi() const; - qreal devicePixelRatio() const; + QRect geometry() const Q_DECL_OVERRIDE; + QRect availableGeometry() const Q_DECL_OVERRIDE; + int depth() const Q_DECL_OVERRIDE; + QImage::Format format() const Q_DECL_OVERRIDE; + QSizeF physicalSize() const Q_DECL_OVERRIDE; + QDpi logicalDpi() const Q_DECL_OVERRIDE; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; - Qt::ScreenOrientation nativeOrientation() const; - Qt::ScreenOrientation orientation() const; - void setOrientationUpdateMask(Qt::ScreenOrientations mask); + Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE; + Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE; + void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE; UIScreen *uiScreen() const; UIWindow *uiWindow() const; diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index d86f545154..e2c61e1161 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -221,6 +221,8 @@ self.keyboardType = UIKeyboardTypePhonePad; else if (hints & Qt::ImhLatinOnly) self.keyboardType = UIKeyboardTypeASCIICapable; + else if (hints & Qt::ImhPreferNumbers) + self.keyboardType = UIKeyboardTypeNumbersAndPunctuation; else self.keyboardType = UIKeyboardTypeDefault; diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h index 9ef179b4dc..58144cb239 100644 --- a/src/plugins/platforms/ios/qiostheme.h +++ b/src/plugins/platforms/ios/qiostheme.h @@ -47,7 +47,7 @@ public: ~QIOSTheme(); const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE; - QVariant themeHint(ThemeHint hint) const; + QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE; QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE; QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE; @@ -55,7 +55,7 @@ public: bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE; QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE; - const QFont *font(Font type = SystemFont) const; + const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE; static const char *name; diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index c53eee1afd..0c65cf8aa5 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -54,29 +54,29 @@ public: explicit QIOSWindow(QWindow *window); ~QIOSWindow(); - void setGeometry(const QRect &rect); + void setGeometry(const QRect &rect) Q_DECL_OVERRIDE; - void setWindowState(Qt::WindowState state); - void setParent(const QPlatformWindow *window); - void handleContentOrientationChange(Qt::ScreenOrientation orientation); - void setVisible(bool visible); + void setWindowState(Qt::WindowState state) Q_DECL_OVERRIDE; + void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE; + void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE; + void setVisible(bool visible) Q_DECL_OVERRIDE; void setOpacity(qreal level) Q_DECL_OVERRIDE; bool isExposed() const Q_DECL_OVERRIDE; void propagateSizeHints() Q_DECL_OVERRIDE {} - void raise() { raiseOrLower(true); } - void lower() { raiseOrLower(false); } + void raise() Q_DECL_OVERRIDE{ raiseOrLower(true); } + void lower() Q_DECL_OVERRIDE { raiseOrLower(false); } bool shouldAutoActivateWindow() const; - void requestActivateWindow(); + void requestActivateWindow() Q_DECL_OVERRIDE; - qreal devicePixelRatio() const; + qreal devicePixelRatio() const Q_DECL_OVERRIDE; - bool setMouseGrabEnabled(bool grab) { return grab; } - bool setKeyboardGrabEnabled(bool grab) { return grab; } + bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; } + bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; } - WId winId() const { return WId(m_view); }; + WId winId() const Q_DECL_OVERRIDE { return WId(m_view); } void clearAccessibleCache(); diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index 8b67f235bb..2189938248 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -689,7 +689,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildI return E_INVALIDARG; QAccessibleInterface *acc = childPointer(accessible, varChildID); - if (acc) { + if (acc && acc->isValid()) { *ppdispChild = QWindowsAccessibility::wrap(acc); return S_OK; } @@ -778,7 +778,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT var QString descr; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; descr = child->text(QAccessible::Description); } else { @@ -803,7 +803,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BST QString help; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; help = child->text(QAccessible::Help); } else { @@ -862,7 +862,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST QString name; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; name = child->text(QAccessible::Name); if (name.isEmpty()) { @@ -910,7 +910,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VAR QAccessible::Role role; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; role = child->role(); } else { @@ -947,7 +947,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VA QAccessible::State state; if (varID.lVal) { QAccessibleInterface *child = childPointer(accessible, varID); - if (!child) + if (!child || !child->isValid()) return E_FAIL; state = child->state(); } else { diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index 4cea845c36..925427ac30 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -69,25 +69,28 @@ static const char formatTextHtmlC[] = "text/html"; \ingroup qt-lighthouse-win */ -QDebug operator<<(QDebug d, const QMimeData &m) +static QDebug operator<<(QDebug d, const QMimeData *mimeData) { QDebugStateSaver saver(d); d.nospace(); - const QStringList formats = m.formats(); - d << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n' - << " Text=" << m.hasText() << " HTML=" << m.hasHtml() - << " Color=" << m.hasColor() << " Image=" << m.hasImage() - << " URLs=" << m.hasUrls() << '\n'; - if (m.hasText()) - d << " Text: '" << m.text() << "'\n"; - if (m.hasHtml()) - d << " HTML: '" << m.html() << "'\n"; - if (m.hasColor()) - d << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n'; - if (m.hasImage()) - d << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n'; - if (m.hasUrls()) - d << " URLs: " << m.urls() << '\n'; + d << "QMimeData("; + if (mimeData) { + const QStringList formats = mimeData->formats(); + d << "formats=" << formats.join(QStringLiteral(", ")); + if (mimeData->hasText()) + d << ", text=" << mimeData->text(); + if (mimeData->hasHtml()) + d << ", html=" << mimeData->html(); + if (mimeData->hasColor()) + d << ", colorData=" << qvariant_cast<QColor>(mimeData->colorData()); + if (mimeData->hasImage()) + d << ", imageData=" << qvariant_cast<QImage>(mimeData->imageData()); + if (mimeData->hasUrls()) + d << ", urls=" << mimeData->urls(); + } else { + d << '0'; + } + d << ')'; return d; } @@ -297,7 +300,7 @@ QMimeData *QWindowsClipboard::mimeData(QClipboard::Mode mode) void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) { - qCDebug(lcQpaMime) << __FUNCTION__ << mode << *mimeData; + qCDebug(lcQpaMime) << __FUNCTION__ << mode << mimeData; if (mode != QClipboard::Clipboard) return; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 27323a2fd6..717adcc47f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -918,7 +918,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodRequest: return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result); case QtWindows::GestureEvent: - return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); +#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) + return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); +#else + return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); +#endif case QtWindows::InputMethodOpenCandidateWindowEvent: case QtWindows::InputMethodCloseCandidateWindowEvent: // TODO: Release/regrab mouse if a popup has mouse grab. diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 1c5b114efd..3b27964b0e 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -933,7 +933,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, } static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM) + int type, LPARAM registerAlias) { const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const uchar charSet = f->elfLogFont.lfCharSet; @@ -943,13 +943,13 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use // anyway - addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, false); + addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type, registerAlias); // keep on enumerating return 1; } -void QWindowsFontDatabase::populateFamily(const QString &familyName) +void QWindowsFontDatabase::populateFamily(const QString &familyName, bool registerAlias) { qCDebug(lcQpaFonts) << familyName; if (familyName.size() >= LF_FACESIZE) { @@ -962,10 +962,15 @@ void QWindowsFontDatabase::populateFamily(const QString &familyName) familyName.toWCharArray(lf.lfFaceName); lf.lfFaceName[familyName.size()] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, 0, 0); + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, (LPARAM)registerAlias, 0); ReleaseDC(0, dummy); } +void QWindowsFontDatabase::populateFamily(const QString &familyName) +{ + populateFamily(familyName, false); +} + namespace { // Context for enumerating system fonts, records whether the default font has been encountered, // which is normally not enumerated by EnumFontFamiliesEx(). @@ -1075,11 +1080,7 @@ QWindowsFontDatabase::~QWindowsFontDatabase() QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) { - if (script == QChar::Script_Common) - return new QWindowsMultiFontEngine(fontEngine, script); - // ### as long as fallbacksForFamily() does not take script parameter into account, - // prefer QFontEngineMulti's loadEngine() implementation for complex scripts - return QPlatformFontDatabase::fontEngineMulti(fontEngine, script); + return new QWindowsMultiFontEngine(fontEngine, script); } QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) @@ -1382,7 +1383,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, // Fonts based on files are added via populate, as they will show up in font enumeration. for (int j = 0; j < families.count(); ++j) - populateFamily(families.at(j)); + populateFamily(families.at(j), true); } m_applicationFonts << font; @@ -1661,11 +1662,10 @@ QString QWindowsFontDatabase::familyForStyleHint(QFont::StyleHint styleHint) QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; + QStringList result; result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint << script << result; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 3615612c78..efb5421996 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -100,6 +100,7 @@ public: static QString familyForStyleHint(QFont::StyleHint styleHint); private: + void populateFamily(const QString &familyName, bool registerAlias); void removeApplicationFonts(); struct WinApplicationFont { diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index ad75a0bd54..795554698c 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -661,9 +661,7 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { - QStringList result = QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script); - if (!result.isEmpty()) - return result; + QStringList result; result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); @@ -679,6 +677,8 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); + result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script)); + qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint << script << result; diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 05c7e6b240..f97c23c207 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -487,7 +487,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) - return QVariant(int(timeMS) * 2); + return QVariant(timeMS != INFINITE ? int(timeMS) * 2 : 0); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.h b/src/plugins/platforms/windows/qwindowsinternalmimedata.h index 09ab417268..6a60a9676a 100644 --- a/src/plugins/platforms/windows/qwindowsinternalmimedata.h +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.h @@ -55,8 +55,6 @@ protected: virtual void releaseDataObject(IDataObject *) const {} }; -QDebug operator<<(QDebug d, const QMimeData &m); - QT_END_NAMESPACE #endif // QWINDOWSINTERNALMIME_H diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index a8aea05fd8..200eb11855 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -465,12 +465,11 @@ bool QWindowsMouseHandler::translateScrollEvent(QWindow *window, HWND, } // from bool QApplicationPrivate::translateTouchEvent() -bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, +bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QtWindows::WindowsEventType, MSG msg, LRESULT *) { #ifndef Q_OS_WINCE - Q_UNUSED(hwnd); typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList; @@ -537,8 +536,24 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); +#else // !Q_OS_WINCE + Q_UNUSED(window) + Q_UNUSED(msg) +#endif return true; -#else //Q_OS_WINCE + +} + +bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType, + MSG msg, LRESULT *) +{ +#ifndef Q_OS_WINCE + Q_UNUSED(window) + Q_UNUSED(hwnd) + Q_UNUSED(msg) + return false; +#else // !Q_OS_WINCE GESTUREINFO gi; memset(&gi, 0, sizeof(GESTUREINFO)); gi.cbSize = sizeof(GESTUREINFO); @@ -617,9 +632,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QWindowSystemInterface::handleEnterEvent(window); m_windowUnderMouse = window; } - return true; -#endif +#endif // Q_OS_WINCE } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index ce3e6b6fc4..61aa8d6084 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -59,6 +59,9 @@ public: bool translateTouchEvent(QWindow *widget, HWND hwnd, QtWindows::WindowsEventType t, MSG msg, LRESULT *result); + bool translateGestureEvent(QWindow *window, HWND hwnd, + QtWindows::WindowsEventType, + MSG msg, LRESULT *); bool translateScrollEvent(QWindow *window, HWND hwnd, MSG msg, LRESULT *result); diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index 6e58c55bbe..db8b2ec094 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -135,7 +135,9 @@ QVariantMap QWindowsNativeInterface::windowProperties(QPlatformWindow *window) c void *QWindowsNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { -#ifndef QT_NO_OPENGL +#ifdef QT_NO_OPENGL + Q_UNUSED(resource) +#else if (resourceType(resource) == GlHandleType) return QWindowsIntegration::staticOpenGLContext()->moduleHandle(); #endif diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 87747a74fd..1b5d7b87bc 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2270,6 +2270,7 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) void *QWindowsWindow::surface(void *nativeConfig, int *err) { #ifdef QT_NO_OPENGL + Q_UNUSED(err) Q_UNUSED(nativeConfig) return 0; #else diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 1fe46ff290..15d3575e60 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -55,7 +55,6 @@ #include <algorithm> -#include <dlfcn.h> #include <stdio.h> #include <errno.h> #include <xcb/shm.h> @@ -77,6 +76,25 @@ #include <xcb/render.h> #endif +#if defined(Q_CC_GNU) && defined(Q_OF_ELF) +static xcb_generic_event_t *local_xcb_poll_for_queued_event(xcb_connection_t *c) + __attribute__((weakref("xcb_poll_for_queued_event"))); + +static inline void checkXcbPollForQueuedEvent() +{ } +#else +#include <dlfcn.h> +typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); +static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event; + +static inline void checkXcbPollForQueuedEvent() +{ +#ifdef RTLD_DEFAULT + local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); +#endif +} +#endif + QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") @@ -252,16 +270,32 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) otherScreen->addVirtualSibling(screen); m_screens << screen; QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); + + // Windows which had null screens have already had expose events by now. + // They need to be told the screen is back, it's OK to render. + foreach (QWindow *window, QGuiApplication::topLevelWindows()) { + QXcbWindow *xcbWin = static_cast<QXcbWindow*>(window->handle()); + if (xcbWin) + xcbWin->maybeSetScreen(screen); + } } // else ignore disabled screens } else if (screen) { // Screen has been disabled -> remove if (output.crtc == XCB_NONE && output.mode == XCB_NONE) { - qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled"; - m_screens.removeOne(screen); - foreach (QXcbScreen *otherScreen, m_screens) - otherScreen->removeVirtualSibling((QPlatformScreen *) screen); - QXcbIntegration::instance()->destroyScreen(screen); + xcb_randr_get_output_info_cookie_t outputInfoCookie = + xcb_randr_get_output_info(xcb_connection(), output.output, output.config_timestamp); + QScopedPointer<xcb_randr_get_output_info_reply_t, QScopedPointerPodDeleter> outputInfo( + xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL)); + if (outputInfo->crtc == XCB_NONE) { + qCDebug(lcQpaScreen) << "output" << screen->name() << "has been disabled"; + m_screens.removeOne(screen); + foreach (QXcbScreen *otherScreen, m_screens) + otherScreen->removeVirtualSibling((QPlatformScreen *) screen); + QXcbIntegration::instance()->destroyScreen(screen); + } else { + qCDebug(lcQpaScreen) << "output" << screen->name() << "has been temporarily disabled for the mode switch"; + } } else { // Just update existing screen screen->updateGeometry(output.config_timestamp); @@ -1153,21 +1187,13 @@ void QXcbConnection::addPeekFunc(PeekFunc f) QXcbEventReader::QXcbEventReader(QXcbConnection *connection) : m_connection(connection) - , m_xcb_poll_for_queued_event(0) { -#ifdef RTLD_DEFAULT - m_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event"); -#endif - -#ifdef Q_XCB_DEBUG - if (m_xcb_poll_for_queued_event) - qDebug("Using threaded event reader with xcb_poll_for_queued_event"); -#endif + checkXcbPollForQueuedEvent(); } void QXcbEventReader::start() { - if (m_xcb_poll_for_queued_event) { + if (local_xcb_poll_for_queued_event) { connect(this, SIGNAL(eventPending()), m_connection, SLOT(processXcbEvents()), Qt::QueuedConnection); connect(this, SIGNAL(finished()), m_connection, SLOT(processXcbEvents())); QThread::start(); @@ -1193,7 +1219,7 @@ void QXcbEventReader::registerEventDispatcher(QAbstractEventDispatcher *dispatch // flush the xcb connection before the EventDispatcher is going to block // In the non-threaded case processXcbEvents is called before going to block, // which flushes the connection. - if (m_xcb_poll_for_queued_event) + if (local_xcb_poll_for_queued_event) connect(dispatcher, SIGNAL(aboutToBlock()), m_connection, SLOT(flush())); } @@ -1203,7 +1229,7 @@ void QXcbEventReader::run() while (m_connection && (event = xcb_wait_for_event(m_connection->xcb_connection()))) { m_mutex.lock(); addEvent(event); - while (m_connection && (event = m_xcb_poll_for_queued_event(m_connection->xcb_connection()))) + while (m_connection && (event = local_xcb_poll_for_queued_event(m_connection->xcb_connection()))) addEvent(event); m_mutex.unlock(); emit eventPending(); @@ -1227,7 +1253,7 @@ void QXcbEventReader::addEvent(xcb_generic_event_t *event) QXcbEventArray *QXcbEventReader::lock() { m_mutex.lock(); - if (!m_xcb_poll_for_queued_event) { + if (!local_xcb_poll_for_queued_event) { while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection->xcb_connection())) m_events << event; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 7016b99425..4a0348aa0c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -324,9 +324,6 @@ private: QMutex m_mutex; QXcbEventArray m_events; QXcbConnection *m_connection; - - typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c); - XcbPollForQueuedEventFunctionPointer m_xcb_poll_for_queued_event; }; class QXcbWindowEventListener diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 4a347a3706..5a2ea74258 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -306,14 +306,13 @@ void QXcbConnection::xi2Select(xcb_window_t window) const bool pointerSelected = isAtLeastXI22() && xi2MouseEvents(); QSet<int> tabletDevices; #ifndef QT_NO_TABLETEVENT - if (!m_tabletData.isEmpty() && !pointerSelected) { + if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask); QVector<XIEventMask> xiEventMask(m_tabletData.count()); - tabletBitMask = XI_ButtonPressMask; - tabletBitMask |= XI_ButtonReleaseMask; - tabletBitMask |= XI_MotionMask; - tabletBitMask |= XI_PropertyEventMask; + tabletBitMask = XI_PropertyEventMask; + if (!pointerSelected) + tabletBitMask |= XI_ButtonPressMask | XI_ButtonReleaseMask | XI_MotionMask; for (int i = 0; i < m_tabletData.count(); ++i) { int deviceId = m_tabletData.at(i).deviceId; tabletDevices.insert(deviceId); @@ -458,17 +457,6 @@ static inline qreal fixed1616ToReal(FP1616 val) } #endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) -#if defined(XCB_USE_XINPUT21) -static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) -{ - if (value > vci->max) - value = vci->max; - if (value < vci->min) - value = vci->min; - return (value - vci->min) / (vci->max - vci->min); -} -#endif // XCB_USE_XINPUT21 - void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) { if (xi2PrepareXIGenericDeviceEvent(event, m_xiOpCode)) { @@ -481,9 +469,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) case XI_ButtonPress: case XI_ButtonRelease: case XI_Motion: +#ifdef XCB_USE_XINPUT22 case XI_TouchBegin: case XI_TouchUpdate: case XI_TouchEnd: +#endif { xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event); eventListener = windowEventListenerFromId(xiDeviceEvent->event); @@ -548,6 +538,15 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) } #ifdef XCB_USE_XINPUT22 +static qreal valuatorNormalized(double value, XIValuatorClassInfo *vci) +{ + if (value > vci->max) + value = vci->max; + if (value < vci->min) + value = vci->min; + return (value - vci->min) / (vci->max - vci->min); +} + void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow) { xXIDeviceEvent *xiDeviceEvent = static_cast<xXIDeviceEvent *>(xiDevEvent); @@ -973,6 +972,8 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q // the pen on the XI 2.2+ path. if (xi2MouseEvents() && eventListener) eventListener->handleXIMouseEvent(reinterpret_cast<xcb_ge_event_t *>(event)); +#else + Q_UNUSED(eventListener); #endif switch (xiEvent->evtype) { diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 6c95de6806..0cd9159052 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -336,8 +336,10 @@ QXcbCursor::~QXcbCursor() if (!--cursorCount) xcb_close_font(conn, cursorFont); +#ifndef QT_NO_CURSOR foreach (xcb_cursor_t cursor, m_cursorHash) xcb_free_cursor(conn, cursor); +#endif } #ifndef QT_NO_CURSOR diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 29262b5847..c6e48dc8c4 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -708,7 +708,7 @@ static inline void formatSizeF(QDebug &debug, const QSizeF s) debug << s.width() << 'x' << s.height() << "mm"; } -Q_XCB_EXPORT QDebug operator<<(QDebug debug, const QXcbScreen *screen) +QDebug operator<<(QDebug debug, const QXcbScreen *screen) { const QDebugStateSaver saver(debug); debug.nospace(); |