diff options
Diffstat (limited to 'src/plugins/platforms')
39 files changed, 501 insertions, 161 deletions
diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 370c3426f5..df8883ab34 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -635,6 +635,11 @@ static void updateWindow(JNIEnv */*env*/, jobject /*thiz*/) if (QGuiApplication::instance() != nullptr) { const auto tlw = QGuiApplication::topLevelWindows(); for (QWindow *w : tlw) { + + // Skip non-platform windows, e.g., offscreen windows. + if (!w->handle()) + continue; + QRect availableGeometry = w->screen()->availableGeometry(); if (w->geometry().width() > 0 && w->geometry().height() > 0 && availableGeometry.width() > 0 && availableGeometry.height() > 0) QWindowSystemInterface::handleExposeEvent(w, QRegion(QRect(QPoint(), w->geometry().size()))); diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index c4387c5d88..b891407c44 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -461,9 +461,9 @@ QVariant QAndroidPlatformTheme::themeHint(ThemeHint hint) const case StyleNames: if (qEnvironmentVariableIntValue("QT_USE_ANDROID_NATIVE_STYLE") && m_androidStyleData) { - return QStringList("android"); + return QStringList(QLatin1String("android")); } - return QStringList("fusion"); + return QStringList(QLatin1String("fusion")); case MouseDoubleClickDistance: { diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index cc8436dcfe..3a5a0c8e78 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -122,7 +122,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); - (void)dealloc { - [self restoreOriginalContentView]; + [mStolenContentView release]; [mColorPanel setDelegate:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 214f44b548..0be931b54f 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -150,7 +150,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); - (void)dealloc { - [self restoreOriginalContentView]; + [mStolenContentView release]; [mFontPanel setDelegate:nil]; [[NSFontManager sharedFontManager] setDelegate:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h index 7ce2059450..4870ca4103 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.h +++ b/src/plugins/platforms/cocoa/qcocoamenubar.h @@ -76,6 +76,7 @@ private: static QCocoaWindow *findWindowForMenubar(); static QCocoaMenuBar *findGlobalMenubar(); + bool needsImmediateUpdate(); bool shouldDisable(QCocoaWindow *active) const; NSMenuItem *nativeItemForMenu(QCocoaMenu *menu) const; diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 26af0d3f63..a95ffc2f9f 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -90,6 +90,32 @@ QCocoaMenuBar::~QCocoaMenuBar() } } +bool QCocoaMenuBar::needsImmediateUpdate() +{ + if (m_window && m_window->window()->isActive()) { + return true; + } else if (!m_window) { + // Only update if the focus/active window has no + // menubar, which means it'll be using this menubar. + // This is to avoid a modification in a parentless + // menubar to affect a window-assigned menubar. + QWindow *fw = QGuiApplication::focusWindow(); + if (!fw) { + // Same if there's no focus window, BTW. + return true; + } else { + QCocoaWindow *cw = static_cast<QCocoaWindow *>(fw->handle()); + if (cw && !cw->menubar()) + return true; + } + } + + // Either the menubar is attached to a non-active window, + // or the application's focus window has its own menubar + // (which is different from this one) + return false; +} + void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) { QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu); @@ -130,7 +156,7 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor syncMenu(menu); - if (m_window && m_window->window()->isActive()) + if (needsImmediateUpdate()) updateMenuBarImmediately(); } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index bd7b23bc1b..2e9de03dfc 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -322,6 +322,8 @@ public: // for QNSView }; QHash<quintptr, BorderRange> m_contentBorderAreas; // identifer -> uppper/lower QHash<quintptr, bool> m_enabledContentBorderAreas; // identifer -> enabled state (true/false) + + bool m_hasWindowFilePath; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4be1917f2d..e377d8f83d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -380,6 +380,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_topContentBorderThickness(0) , m_bottomContentBorderThickness(0) , m_normalGeometry(QRect(0,0,-1,-1)) + , m_hasWindowFilePath(false) { qCDebug(lcQpaCocoaWindow) << "QCocoaWindow::QCocoaWindow" << window(); @@ -935,6 +936,7 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath) QFileInfo fi(filePath); [m_nsWindow setRepresentedFilename:fi.exists() ? filePath.toNSString() : @""]; + m_hasWindowFilePath = fi.exists(); } void QCocoaWindow::setWindowIcon(const QIcon &icon) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index f90713d48d..6181997923 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -874,11 +874,6 @@ static bool _q_dontOverrideCtrlLMB = false; if (!(m_acceptedMouseDowns & button) == button) return false; - if (!(m_buttons & (m_sendUpAsRightButton ? Qt::RightButton : Qt::LeftButton))) { - qCWarning(lcQpaCocoaWindow) << "QNSView mouseDragged: Internal mouse button tracking" - << "invalid (missing Qt::LeftButton)"; - } - [self handleMouseEvent:theEvent]; return true; } diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index 46e8d40efb..f29aa97b68 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -59,6 +59,8 @@ - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; - (void)windowWillClose:(NSNotification *)notification; +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu; +- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard; @end QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSWindowDelegate); diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index cbae4fc50f..7f988ac963 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -123,4 +123,19 @@ m_cocoaWindow->windowWillClose(); } +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu +{ + Q_UNUSED(window); + Q_UNUSED(menu); + return m_cocoaWindow && m_cocoaWindow->m_hasWindowFilePath; +} + +- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard +{ + Q_UNUSED(window); + Q_UNUSED(event); + Q_UNUSED(dragImageLocation); + Q_UNUSED(pasteboard); + return m_cocoaWindow && m_cocoaWindow->m_hasWindowFilePath; +} @end diff --git a/src/plugins/platforms/eglfs/api/qeglfshooks.cpp b/src/plugins/platforms/eglfs/api/qeglfshooks.cpp index b67d8fab54..d8332a94cb 100644 --- a/src/plugins/platforms/eglfs/api/qeglfshooks.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfshooks.cpp @@ -66,7 +66,8 @@ private: Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration) -DeviceIntegration::DeviceIntegration() : m_integration(0) +DeviceIntegration::DeviceIntegration() + : m_integration(nullptr) { QStringList pluginKeys = QEglFSDeviceIntegrationFactory::keys(); if (!pluginKeys.isEmpty()) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index d30963ff96..60989e2bd0 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -79,7 +79,7 @@ void QEglFSKmsEglDevice::close() EGLNativeDisplayType QEglFSKmsEglDevice::nativeDisplay() const { - return static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice(); + return reinterpret_cast<EGLNativeDisplayType>(static_cast<QEglFSKmsEglDeviceIntegration *>(m_integration)->eglDevice()); } QEglFSKmsScreen *QEglFSKmsEglDevice::createScreen(QEglFSKmsIntegration *integration, QEglFSKmsDevice *device, diff --git a/src/plugins/platforms/ios/ios.pro b/src/plugins/platforms/ios/ios.pro index 56efd12435..594ccefcf1 100644 --- a/src/plugins/platforms/ios/ios.pro +++ b/src/plugins/platforms/ios/ios.pro @@ -1,74 +1,2 @@ -TARGET = qios - -QT += \ - core-private gui-private \ - clipboard_support-private fontdatabase_support-private graphics_support-private - -LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox - -OBJECTIVE_SOURCES = \ - plugin.mm \ - qiosintegration.mm \ - qioseventdispatcher.mm \ - qioswindow.mm \ - qiosscreen.mm \ - qiosbackingstore.mm \ - qiosapplicationdelegate.mm \ - qiosapplicationstate.mm \ - qiosviewcontroller.mm \ - qioscontext.mm \ - qiosinputcontext.mm \ - qiostheme.mm \ - qiosglobal.mm \ - qiosservices.mm \ - quiview.mm \ - quiaccessibilityelement.mm \ - qiosplatformaccessibility.mm \ - qiostextresponder.mm - -HEADERS = \ - qiosintegration.h \ - qioseventdispatcher.h \ - qioswindow.h \ - qiosscreen.h \ - qiosbackingstore.h \ - qiosapplicationdelegate.h \ - qiosapplicationstate.h \ - qiosviewcontroller.h \ - qioscontext.h \ - qiosinputcontext.h \ - qiostheme.h \ - qiosglobal.h \ - qiosservices.h \ - quiview.h \ - quiaccessibilityelement.h \ - qiosplatformaccessibility.h \ - qiostextresponder.h \ - qiosfileenginefactory.h - -!tvos { - LIBS += -framework AssetsLibrary - OBJECTIVE_SOURCES += \ - qiosclipboard.mm \ - qiosmenu.mm \ - qiosfileengineassetslibrary.mm \ - qiosfiledialog.mm \ - qiosmessagedialog.mm \ - qiostextinputoverlay.mm - HEADERS += \ - qiosclipboard.h \ - qiosmenu.h \ - qiosfileengineassetslibrary.h \ - qiosfiledialog.h \ - qiosmessagedialog.h \ - qiostextinputoverlay.h -} - -OTHER_FILES = \ - quiview_textinput.mm \ - quiview_accessibility.mm - -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QIOSIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) +TEMPLATE = subdirs +SUBDIRS = kernel.pro optional diff --git a/src/plugins/platforms/ios/kernel.pro b/src/plugins/platforms/ios/kernel.pro new file mode 100644 index 0000000000..5485ccc374 --- /dev/null +++ b/src/plugins/platforms/ios/kernel.pro @@ -0,0 +1,72 @@ +TARGET = qios + +QT += \ + core-private gui-private \ + clipboard_support-private fontdatabase_support-private graphics_support-private + +LIBS += -framework Foundation -framework UIKit -framework QuartzCore -framework AudioToolbox + +OBJECTIVE_SOURCES = \ + plugin.mm \ + qiosintegration.mm \ + qioseventdispatcher.mm \ + qioswindow.mm \ + qiosscreen.mm \ + qiosbackingstore.mm \ + qiosapplicationdelegate.mm \ + qiosapplicationstate.mm \ + qiosviewcontroller.mm \ + qioscontext.mm \ + qiosinputcontext.mm \ + qiostheme.mm \ + qiosglobal.mm \ + qiosservices.mm \ + quiview.mm \ + quiaccessibilityelement.mm \ + qiosplatformaccessibility.mm \ + qiostextresponder.mm + +HEADERS = \ + qiosintegration.h \ + qioseventdispatcher.h \ + qioswindow.h \ + qiosscreen.h \ + qiosbackingstore.h \ + qiosapplicationdelegate.h \ + qiosapplicationstate.h \ + qiosviewcontroller.h \ + qioscontext.h \ + qiosinputcontext.h \ + qiostheme.h \ + qiosglobal.h \ + qiosservices.h \ + quiview.h \ + quiaccessibilityelement.h \ + qiosplatformaccessibility.h \ + qiostextresponder.h \ + qiosfileenginefactory.h + +!tvos { + LIBS += -framework AssetsLibrary + OBJECTIVE_SOURCES += \ + qiosclipboard.mm \ + qiosmenu.mm \ + qiosfiledialog.mm \ + qiosmessagedialog.mm \ + qiostextinputoverlay.mm + HEADERS += \ + qiosclipboard.h \ + qiosmenu.h \ + qiosfiledialog.h \ + qiosmessagedialog.h \ + qiostextinputoverlay.h +} + +OTHER_FILES = \ + quiview_textinput.mm \ + quiview_accessibility.mm + +PLUGIN_TYPE = platforms +PLUGIN_CLASS_NAME = QIOSIntegrationPlugin +!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - +load(qt_plugin) diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/nsphotolibrarysupport.pro b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/nsphotolibrarysupport.pro new file mode 100644 index 0000000000..f4588dda03 --- /dev/null +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/nsphotolibrarysupport.pro @@ -0,0 +1,22 @@ +TARGET = qiosnsphotolibrarysupport + +QT += core gui gui-private +LIBS += -framework UIKit -framework AssetsLibrary + +HEADERS = \ + qiosfileengineassetslibrary.h \ + qiosfileenginefactory.h \ + qiosimagepickercontroller.h + +OBJECTIVE_SOURCES = \ + plugin.mm \ + qiosfileengineassetslibrary.mm \ + qiosimagepickercontroller.mm \ + +OTHER_FILES = \ + plugin.json + +PLUGIN_CLASS_NAME = QIosOptionalPlugin_NSPhotoLibrary +PLUGIN_EXTENDS = - +PLUGIN_TYPE = platforms/darwin +load(qt_plugin) diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.json b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.json new file mode 100644 index 0000000000..4491fb3d59 --- /dev/null +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.json @@ -0,0 +1,3 @@ +{ + "Keys": [ "NSPhotoLibrarySupport" ] +} diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm new file mode 100644 index 0000000000..2ec0d33a41 --- /dev/null +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/plugin.mm @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../qiosoptionalplugininterface.h" +#include "../../qiosfiledialog.h" + +#include "qiosimagepickercontroller.h" +#include "qiosfileenginefactory.h" + +QT_BEGIN_NAMESPACE + +class QIosOptionalPlugin_NSPhotoLibrary : public QObject, QIosOptionalPluginInterface +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QIosOptionalPluginInterface_iid FILE "plugin.json") + Q_INTERFACES(QIosOptionalPluginInterface) + +public: + explicit QIosOptionalPlugin_NSPhotoLibrary(QObject* = 0) {}; + ~QIosOptionalPlugin_NSPhotoLibrary() {} + + UIViewController* createImagePickerController(QIOSFileDialog *fileDialog) const override + { + return [[[QIOSImagePickerController alloc] initWithQIOSFileDialog:fileDialog] autorelease]; + } + +private: + QIOSFileEngineFactory m_fileEngineFactory; + +}; + +QT_END_NAMESPACE + +#include "plugin.moc" diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.h b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.h index 06f2e8d2ca..8d7cabf15b 100644 --- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.h +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.h @@ -43,6 +43,9 @@ #include <QtCore/private/qabstractfileengine_p.h> Q_FORWARD_DECLARE_OBJC_CLASS(ALAsset); + +QT_BEGIN_NAMESPACE + class QIOSAssetData; class QIOSFileEngineAssetsLibrary : public QAbstractFileEngine @@ -51,20 +54,20 @@ public: QIOSFileEngineAssetsLibrary(const QString &fileName); ~QIOSFileEngineAssetsLibrary(); - bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE; - bool close() Q_DECL_OVERRIDE; - FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE; - qint64 size() const Q_DECL_OVERRIDE; - qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE; - qint64 pos() const Q_DECL_OVERRIDE; - bool seek(qint64 pos) Q_DECL_OVERRIDE; - QString fileName(FileName file) const Q_DECL_OVERRIDE; - void setFileName(const QString &file) Q_DECL_OVERRIDE; - QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE; + bool open(QIODevice::OpenMode openMode) override; + bool close() override; + FileFlags fileFlags(FileFlags type) const override; + qint64 size() const override; + qint64 read(char *data, qint64 maxlen) override; + qint64 pos() const override; + bool seek(qint64 pos) override; + QString fileName(FileName file) const override; + void setFileName(const QString &file) override; + QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override; #ifndef QT_NO_FILESYSTEMITERATOR - Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) Q_DECL_OVERRIDE; - Iterator *endEntryList() Q_DECL_OVERRIDE; + Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override; + Iterator *endEntryList() override; #endif void setError(QFile::FileError error, const QString &str) { QAbstractFileEngine::setError(error, str); } @@ -78,5 +81,7 @@ private: ALAsset *loadAsset() const; }; +QT_END_NAMESPACE + #endif // QIOSFILEENGINEASSETSLIBRARY_H diff --git a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm index 560c54924a..bea2897240 100644 --- a/src/plugins/platforms/ios/qiosfileengineassetslibrary.mm +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm @@ -48,6 +48,8 @@ #include <QtCore/qset.h> #include <QtCore/qthreadstorage.h> +QT_BEGIN_NAMESPACE + static QThreadStorage<QString> g_iteratorCurrentUrl; static QThreadStorage<QPointer<QIOSAssetData> > g_assetDataCache; @@ -472,4 +474,6 @@ QAbstractFileEngine::Iterator *QIOSFileEngineAssetsLibrary::endEntryList() return 0; } +QT_END_NAMESPACE + #endif diff --git a/src/plugins/platforms/ios/qiosfileenginefactory.h b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h index 87665ac603..b143357aa5 100644 --- a/src/plugins/platforms/ios/qiosfileenginefactory.h +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileenginefactory.h @@ -44,6 +44,8 @@ #include <QtCore/private/qabstractfileengine_p.h> #include "qiosfileengineassetslibrary.h" +QT_BEGIN_NAMESPACE + class QIOSFileEngineFactory : public QAbstractFileEngineHandler { public: @@ -62,4 +64,6 @@ public: } }; +QT_END_NAMESPACE + #endif // QIOSFILEENGINEFACTORY_H diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h new file mode 100644 index 0000000000..df3f6b9fa3 --- /dev/null +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#import <UIKit/UIKit.h> + +#include "../../qiosfiledialog.h" + +@interface QIOSImagePickerController : UIImagePickerController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { + QIOSFileDialog *m_fileDialog; +} +- (id)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog; +@end diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm new file mode 100644 index 0000000000..f9662b964a --- /dev/null +++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosimagepickercontroller.mm @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#import <UIKit/UIKit.h> + +#include "qiosimagepickercontroller.h" + +@implementation QIOSImagePickerController + +- (id)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog +{ + self = [super init]; + if (self) { + m_fileDialog = fileDialog; + [self setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; + [self setDelegate:self]; + } + return self; +} + +- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info +{ + Q_UNUSED(picker); + NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL]; + QUrl fileUrl = QUrl::fromLocalFile(QString::fromNSString([url description])); + m_fileDialog->selectedFilesChanged(QList<QUrl>() << fileUrl); + emit m_fileDialog->accept(); +} + +- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker +{ + Q_UNUSED(picker) + emit m_fileDialog->reject(); +} + +@end diff --git a/src/plugins/platforms/ios/optional/optional.pro b/src/plugins/platforms/ios/optional/optional.pro new file mode 100644 index 0000000000..5e3421a025 --- /dev/null +++ b/src/plugins/platforms/ios/optional/optional.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = nsphotolibrarysupport diff --git a/src/plugins/platforms/ios/qiosfiledialog.h b/src/plugins/platforms/ios/qiosfiledialog.h index 7fe24eaefe..0b56bd20bf 100644 --- a/src/plugins/platforms/ios/qiosfiledialog.h +++ b/src/plugins/platforms/ios/qiosfiledialog.h @@ -72,6 +72,8 @@ private: QList<QUrl> m_selection; QEventLoop m_eventLoop; UIViewController *m_viewController; + + bool showImagePickerDialog(QWindow *parent); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosfiledialog.mm b/src/plugins/platforms/ios/qiosfiledialog.mm index 70536fc5dc..c5722d33f8 100644 --- a/src/plugins/platforms/ios/qiosfiledialog.mm +++ b/src/plugins/platforms/ios/qiosfiledialog.mm @@ -37,52 +37,18 @@ ** ****************************************************************************/ -#include "qiosfiledialog.h" - #import <UIKit/UIKit.h> #include <QtCore/qstandardpaths.h> #include <QtGui/qwindow.h> +#include <QDebug> -@interface QIOSImagePickerController : UIImagePickerController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { - QIOSFileDialog *m_fileDialog; -} -@end - -@implementation QIOSImagePickerController - -- (id)initWithQIOSFileDialog:(QIOSFileDialog *)fileDialog -{ - self = [super init]; - if (self) { - m_fileDialog = fileDialog; - [self setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; - [self setDelegate:self]; - } - return self; -} - -- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info -{ - Q_UNUSED(picker); - NSURL *url = [info objectForKey:UIImagePickerControllerReferenceURL]; - QUrl fileUrl = QUrl::fromLocalFile(QString::fromNSString([url description])); - m_fileDialog->selectedFilesChanged(QList<QUrl>() << fileUrl); - emit m_fileDialog->accept(); -} - -- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker -{ - Q_UNUSED(picker) - emit m_fileDialog->reject(); -} - -@end - -// -------------------------------------------------------------------------- +#include "qiosfiledialog.h" +#include "qiosintegration.h" +#include "qiosoptionalplugininterface.h" QIOSFileDialog::QIOSFileDialog() - : m_viewController(0) + : m_viewController(Q_NULLPTR) { } @@ -104,17 +70,36 @@ bool QIOSFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality window bool acceptOpen = options()->acceptMode() == QFileDialogOptions::AcceptOpen; QString directory = options()->initialDirectory().toLocalFile(); - if (acceptOpen && directory.startsWith(QLatin1String("assets-library:"))) { - m_viewController = [[QIOSImagePickerController alloc] initWithQIOSFileDialog:this]; - UIWindow *window = parent ? reinterpret_cast<UIView *>(parent->winId()).window - : [UIApplication sharedApplication].keyWindow; - [window.rootViewController presentViewController:m_viewController animated:YES completion:nil]; - return true; - } + if (acceptOpen && directory.startsWith(QLatin1String("assets-library:"))) + return showImagePickerDialog(parent); return false; } +bool QIOSFileDialog::showImagePickerDialog(QWindow *parent) +{ + if (!m_viewController) { + QFactoryLoader *plugins = QIOSIntegration::instance()->optionalPlugins(); + for (int i = 0; i < plugins->metaData().size(); ++i) { + QIosOptionalPluginInterface *plugin = qobject_cast<QIosOptionalPluginInterface *>(plugins->instance(i)); + m_viewController = [plugin->createImagePickerController(this) retain]; + if (m_viewController) + break; + } + } + + if (!m_viewController) { + qWarning() << "QIOSFileDialog: Could not resolve Qt plugin that gives access to photos on iOS"; + return false; + } + + UIWindow *window = parent ? reinterpret_cast<UIView *>(parent->winId()).window + : [UIApplication sharedApplication].keyWindow; + [window.rootViewController presentViewController:m_viewController animated:YES completion:nil]; + + return true; +} + void QIOSFileDialog::hide() { // QFileDialog will remember the last directory set, and open subsequent dialogs in the same @@ -126,6 +111,8 @@ void QIOSFileDialog::hide() emit directoryEntered(QUrl::fromLocalFile(QDir::currentPath())); [m_viewController dismissViewControllerAnimated:YES completion:nil]; + [m_viewController release]; + m_viewController = Q_NULLPTR; m_eventLoop.exit(); } diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index d9a43a683e..54c1a1dcb7 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -44,8 +44,9 @@ #include <qpa/qplatformnativeinterface.h> #include <qpa/qwindowsysteminterface.h> +#include <QtCore/private/qfactoryloader_p.h> + #include "qiosapplicationstate.h" -#include "qiosfileenginefactory.h" #ifndef Q_OS_TVOS #include "qiostextinputoverlay.h" #endif @@ -106,6 +107,8 @@ public: void setDebugWindowManagement(bool); bool debugWindowManagement() const; + QFactoryLoader *optionalPlugins() { return m_optionalPlugins; } + private: QPlatformFontDatabase *m_fontDatabase; #ifndef Q_OS_TVOS @@ -116,7 +119,7 @@ private: QIOSApplicationState m_applicationState; QIOSServices *m_platformServices; mutable QPlatformAccessibility *m_accessibility; - QIOSFileEngineFactory m_fileEngineFactory; + QFactoryLoader *m_optionalPlugins; #ifndef Q_OS_TVOS QIOSTextInputOverlay m_textInputOverlay; #endif diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 44e636bae6..e5b4d6da85 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -51,6 +51,7 @@ #include "qiosinputcontext.h" #include "qiostheme.h" #include "qiosservices.h" +#include "qiosoptionalplugininterface.h" #include <QtGui/private/qguiapplication_p.h> @@ -80,6 +81,7 @@ QIOSIntegration::QIOSIntegration() , m_inputContext(0) , m_platformServices(new QIOSServices) , m_accessibility(0) + , m_optionalPlugins(new QFactoryLoader(QIosOptionalPluginInterface_iid, QLatin1String("/platforms/darwin"))) , m_debugWindowManagement(false) { if (Q_UNLIKELY(![UIApplication sharedApplication])) { @@ -124,6 +126,9 @@ QIOSIntegration::QIOSIntegration() m_touchDevice->setCapabilities(touchCapabilities); QWindowSystemInterface::registerTouchDevice(m_touchDevice); QMacInternalPasteboardMime::initializeMimeTypes(); + + for (int i = 0; i < m_optionalPlugins->metaData().size(); ++i) + qobject_cast<QIosOptionalPluginInterface *>(m_optionalPlugins->instance(i))->initPlugin(); } QIOSIntegration::~QIOSIntegration() @@ -148,6 +153,9 @@ QIOSIntegration::~QIOSIntegration() delete m_accessibility; m_accessibility = 0; + + delete m_optionalPlugins; + m_optionalPlugins = 0; } bool QIOSIntegration::hasCapability(Capability cap) const diff --git a/src/plugins/platforms/ios/qiosoptionalplugininterface.h b/src/plugins/platforms/ios/qiosoptionalplugininterface.h new file mode 100644 index 0000000000..bcb8978e02 --- /dev/null +++ b/src/plugins/platforms/ios/qiosoptionalplugininterface.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QIOPLUGININTERFACE_H +#define QIOPLUGININTERFACE_H + +#include <QtCore/QtPlugin> + +#include "qiosfiledialog.h" + +QT_BEGIN_NAMESPACE + +Q_FORWARD_DECLARE_OBJC_CLASS(UIViewController); + +#define QIosOptionalPluginInterface_iid "org.qt-project.Qt.QPA.ios.optional" + +class QIosOptionalPluginInterface +{ +public: + virtual ~QIosOptionalPluginInterface() {} + virtual void initPlugin() const {}; + virtual UIViewController* createImagePickerController(QIOSFileDialog *) const { return Q_NULLPTR; }; +}; + +Q_DECLARE_INTERFACE(QIosOptionalPluginInterface, QIosOptionalPluginInterface_iid) + +QT_END_NAMESPACE + +#endif // QIOPLUGININTERFACE_H diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 013061a6d2..c518f9111d 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -214,8 +214,8 @@ QIOSScreen::QIOSScreen(UIScreen *screen) else m_depth = 24; - if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2)$"))) { - // iPhone 6 Plus or iPhone 6S Plus + if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2|9,2|9,4)$"))) { + // iPhone Plus models m_physicalDpi = 401; } else if (deviceIdentifier.contains(QRegularExpression("^iPad(1,1|2,[1-4]|3,[1-6]|4,[1-3]|5,[3-4]|6,[7-8])$"))) { // All iPads except the iPad Mini series diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm index 9d73a296fa..238d7addf6 100644 --- a/src/plugins/platforms/ios/qiostextinputoverlay.mm +++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm @@ -994,7 +994,8 @@ QIOSTextInputOverlay::QIOSTextInputOverlay() QIOSTextInputOverlay::~QIOSTextInputOverlay() { - disconnect(qApp, 0, this, 0); + if (qApp) + disconnect(qApp, 0, this, 0); } void QIOSTextInputOverlay::updateFocusObject() diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp index 2afe42532e..c564e1e431 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp @@ -58,7 +58,8 @@ #include <QtGui/QOpenGLContext> #include <QtGui/QScreen> -#include <QtEglSupport/private/qt_egl_p.h> +// this is where EGL headers are pulled in, make sure it is last +#include "qminimaleglscreen.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.h b/src/plugins/platforms/minimalegl/qminimaleglintegration.h index 020fa09443..529e89f85a 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglintegration.h +++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.h @@ -40,8 +40,6 @@ #ifndef QMINIMALEGLINTEGRATION_H #define QMINIMALEGLINTEGRATION_H -#include "qminimaleglscreen.h" - #include <qpa/qplatformintegration.h> #include <qpa/qplatformscreen.h> diff --git a/src/plugins/platforms/minimalegl/qminimaleglwindow.h b/src/plugins/platforms/minimalegl/qminimaleglwindow.h index 5c2955f783..b8bfd6c8d2 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglwindow.h +++ b/src/plugins/platforms/minimalegl/qminimaleglwindow.h @@ -41,7 +41,6 @@ #define QMINIMALEGLWINDOW_H #include "qminimaleglintegration.h" -#include "qminimaleglscreen.h" #include <qpa/qplatformwindow.h> diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index 1e00da52eb..dd99e674ec 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -102,6 +102,18 @@ "features": [ "disable_desktopgl", "disable_d3d11", "disable_d3d9" ] + }, + { + "id": 9, + "description": "Intel 945 crash (QTBUG-40991)", + "vendor_id": "0x8086", + "device_id": [ "0x27A2" ], + "os": { + "type": "win" + }, + "features": [ + "disable_desktopgl" + ] } ] } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp index e534ae13c6..8df8b28f72 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp @@ -59,6 +59,10 @@ const xcb_visualtype_t *QXcbGlxWindow::createVisual() if (!scr) return Q_NULLPTR; XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(scr), scr->screenNumber(), &m_format); + if (!visualInfo) { + qWarning() << "No XVisualInfo for format" << m_format; + return Q_NULLPTR; + } const xcb_visualtype_t *xcb_visualtype = scr->visualForId(visualInfo->visualid); XFree(visualInfo); return xcb_visualtype; diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 130ae9be0c..3d09b1c139 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -168,12 +168,13 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI return; int id = shmget(IPC_PRIVATE, segmentSize, IPC_CREAT | 0600); - if (id == -1) + if (id == -1) { qWarning("QXcbShmImage: shmget() failed (%d: %s) for size %d (%dx%d)", errno, strerror(errno), segmentSize, size.width(), size.height()); - else - m_shm_info.shmid = id; - m_shm_info.shmaddr = m_xcb_image->data = (quint8 *)shmat (m_shm_info.shmid, 0, 0); + } else { + m_shm_info.shmaddr = m_xcb_image->data = (quint8 *)shmat(id, 0, 0); + } + m_shm_info.shmid = id; m_shm_info.shmseg = xcb_generate_id(xcb_connection()); const xcb_query_extension_reply_t *shm_reply = xcb_get_extension_data(xcb_connection(), &xcb_shm_id); @@ -184,9 +185,10 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI if (!shm_present || error || id == -1) { free(error); - shmdt(m_shm_info.shmaddr); - shmctl(m_shm_info.shmid, IPC_RMID, 0); - + if (id != -1) { + shmdt(m_shm_info.shmaddr); + shmctl(m_shm_info.shmid, IPC_RMID, 0); + } m_shm_info.shmaddr = 0; m_xcb_image->data = (uint8_t *)malloc(segmentSize); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index d577d46b96..7bd233f387 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -116,6 +116,7 @@ Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen") #define XCB_GE_GENERIC 35 #endif +#if defined(XCB_USE_XINPUT2) // Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: // - "pad0" became "extension" // - "pad1" and "pad" became "pad0" @@ -133,6 +134,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) qt_xcb_ge_event_t *e = (qt_xcb_ge_event_t *)event; return e->extension == opCode; } +#endif // XCB_USE_XINPUT2 #ifdef XCB_USE_XLIB static const char * const xcbConnectionErrors[] = { diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index ee7bfd6c53..0c8e78491e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -1691,9 +1691,11 @@ void QXcbWindow::requestActivateWindow() m_deferredActivation = false; updateNetWmUserTime(connection()->time()); + QWindow *focusWindow = QGuiApplication::focusWindow(); if (window()->isTopLevel() && !(window()->flags() & Qt::X11BypassWindowManagerHint) + && (!focusWindow || !window()->isAncestorOf(focusWindow)) && connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_ACTIVE_WINDOW))) { xcb_client_message_event_t event; @@ -1704,7 +1706,6 @@ void QXcbWindow::requestActivateWindow() event.type = atom(QXcbAtom::_NET_ACTIVE_WINDOW); event.data.data32[0] = 1; event.data.data32[1] = connection()->time(); - QWindow *focusWindow = QGuiApplication::focusWindow(); event.data.data32[2] = focusWindow ? focusWindow->winId() : XCB_NONE; event.data.data32[3] = 0; event.data.data32[4] = 0; |