diff options
45 files changed, 379 insertions, 180 deletions
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 1dea3578c0..c3d174d878 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -217,7 +217,7 @@ private: friend class QWidget; friend class QWidgetWindow; friend class QWidgetPrivate; - friend class QEventDispatcherMacPrivate; + friend class QCocoaEventDispatcherPrivate; friend bool qt_sendSpontaneousEvent(QObject*, QEvent*); friend Q_CORE_EXPORT QString qAppName(); friend class QClassFactory; diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 09df411404..bfc2e44deb 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -38,7 +38,6 @@ qpa { HEADERS += \ kernel/qgenericpluginfactory_qpa.h \ kernel/qgenericplugin_qpa.h \ - kernel/qeventdispatcher_qpa_p.h \ kernel/qwindowsysteminterface_qpa.h \ kernel/qwindowsysteminterface_qpa_p.h \ kernel/qplatformintegration_qpa.h \ @@ -63,7 +62,6 @@ qpa { kernel/qcursor_qpa.cpp \ kernel/qgenericpluginfactory_qpa.cpp \ kernel/qgenericplugin_qpa.cpp \ - kernel/qeventdispatcher_qpa.cpp \ kernel/qwindowsysteminterface_qpa.cpp \ kernel/qplatformintegration_qpa.cpp \ kernel/qplatformscreen_qpa.cpp \ @@ -79,23 +77,6 @@ qpa { kernel/qsurfaceformat.cpp \ kernel/qguiapplication.cpp \ kernel/qwindow.cpp - - contains(QT_CONFIG, glib) { - SOURCES += \ - kernel/qeventdispatcher_glib_qpa.cpp - HEADERS += \ - kernel/qeventdispatcher_glib_qpa_p.h - QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS_PRIVATE +=$$QT_LIBS_GLIB - } -} - -mac { - HEADERS += \ - kernel/qeventdispatcher_mac_p.h - OBJECTIVE_SOURCES += \ - kernel/qeventdispatcher_mac.mm - LIBS += -framework CoreFoundation -framework Cocoa -framework Carbon } win32:HEADERS+=kernel/qwindowdefs_win.h diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 4e53973568..e3a2b5877d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -46,14 +46,6 @@ #include "private/qevent_p.h" #include "qfont.h" -#if !defined(QT_NO_GLIB) -#include "qeventdispatcher_glib_qpa_p.h" -#endif -#include "qeventdispatcher_qpa_p.h" -#ifdef Q_OS_MAC -#include "qeventdispatcher_mac_p.h" -#endif - #include <QtCore/QAbstractEventDispatcher> #include <QtCore/private/qcoreapplication_p.h> #include <QtCore/private/qabstracteventdispatcher_p.h> @@ -240,24 +232,9 @@ static void init_plugins(const QList<QByteArray> &pluginList) } } -void QGuiApplicationPrivate::createEventDispatcher() -{ - Q_Q(QGuiApplication); -#if !defined(QT_NO_GLIB) && !defined(Q_OS_WIN) - if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) - eventDispatcher = new QPAEventDispatcherGlib(q); - else -#endif -#ifdef Q_OS_MAC - eventDispatcher = new QEventDispatcherMac(q); -#else - eventDispatcher = new QEventDispatcherQPA(q); -#endif -} - -void QGuiApplicationPrivate::init() +void QGuiApplicationPrivate::createPlatformIntegration() { - QList<QByteArray> pluginList; + // Load the platform integration QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH")); QByteArray platformName; #ifdef QT_QPA_DEFAULT_PLATFORM_NAME @@ -283,7 +260,45 @@ void QGuiApplicationPrivate::init() } else if (arg == "-platform") { if (++i < argc) platformName = argv[i]; - } else if (arg == "-plugin") { + } else { + argv[j++] = argv[i]; + } + } + + if (j < argc) { + argv[j] = 0; + argc = j; + } + + init_platform(QLatin1String(platformName), platformPluginPath); + +} + +void QGuiApplicationPrivate::createEventDispatcher() +{ + Q_Q(QGuiApplication); + + if (platform_integration == 0) + createPlatformIntegration(); + + eventDispatcher = platform_integration->createEventDispatcher(); + eventDispatcher->setParent(q); +} + +void QGuiApplicationPrivate::init() +{ + qDebug() << "QGuiApplicationPrivate::init"; + QList<QByteArray> pluginList; + // Get command line params + + int j = argc ? 1 : 0; + for (int i=1; i<argc; i++) { + if (argv[i] && *argv[i] != '-') { + argv[j++] = argv[i]; + continue; + } + QByteArray arg = argv[i]; + if (arg == "-plugin") { if (++i < argc) pluginList << argv[i]; } else if (arg == "-reverse") { @@ -299,14 +314,9 @@ void QGuiApplicationPrivate::init() argc = j; } -#if 0 - QByteArray pluginEnv = qgetenv("QT_QPA_PLUGINS"); - if (!pluginEnv.isEmpty()) { - pluginList.append(pluginEnv.split(';')); - } -#endif + if (platform_integration == 0) + createPlatformIntegration(); - init_platform(QLatin1String(platformName), platformPluginPath); init_plugins(pluginList); // Set up which span functions should be used in raster engine... diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index c80212f8f9..6d44caa35a 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -67,6 +67,7 @@ public: QGuiApplicationPrivate(int &argc, char **argv, int flags); ~QGuiApplicationPrivate(); + void createPlatformIntegration(); void createEventDispatcher(); virtual void notifyLayoutDirectionChange(); diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index fe90ce86aa..773f1a31f6 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -214,6 +214,13 @@ QPlatformGLContext *QPlatformIntegration::createPlatformGLContext(const QSurface QRect(x,y,width,height). */ +/*! + \fn QAbstractEventDispatcher *createEventDispatcher() const + + Factory function for the event dispatcher. The platform plugin + must create and and return a QAbstractEventDispatcher subclass when + this function is called. +*/ bool QPlatformIntegration::hasCapability(Capability cap) const { diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index c1934ec83a..23353b715c 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -63,6 +63,7 @@ class QPlatformPrinterSupport; class QPlatformDrag; class QPlatformGLContext; class QGuiGLFormat; +class QAbstractEventDispatcher; class Q_GUI_EXPORT QPlatformIntegration { @@ -88,6 +89,9 @@ public: virtual bool isVirtualDesktop() { return false; } virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const; +// Event dispatcher: + virtual QAbstractEventDispatcher *createEventDispatcher() const = 0; + //Deeper window system integrations virtual QPlatformFontDatabase *fontDatabase() const; #ifndef QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 912ac877fb..5c9a6b06b2 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -47,7 +47,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QWindowSystemInterfacePrivate { +class Q_GUI_EXPORT QWindowSystemInterfacePrivate { public: enum EventType { Close, diff --git a/src/platformsupport/eventdispatchers/eventdispatchers.pri b/src/platformsupport/eventdispatchers/eventdispatchers.pri new file mode 100644 index 0000000000..1b207b73d7 --- /dev/null +++ b/src/platformsupport/eventdispatchers/eventdispatchers.pri @@ -0,0 +1,16 @@ +unix { +SOURCES +=\ + $$PWD/qeventdispatcher_qpa.cpp\ + $$PWD/qgenericunixeventdispatcher.cpp\ + +HEADERS +=\ + $$PWD/qeventdispatcher_qpa_p.h\ + $$PWD/qgenericunixeventdispatcher_p.h\ +} + +contains(QT_CONFIG, glib) { + SOURCES +=$$PWD/qeventdispatcher_glib.cpp + HEADERS +=$$PWD/qeventdispatcher_glib_p.h + QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB + LIBS_PRIVATE += $$QT_LIBS_GLIB +}
\ No newline at end of file diff --git a/src/platformsupport/eventdispatchers/fontdatabases.pri b/src/platformsupport/eventdispatchers/fontdatabases.pri new file mode 100644 index 0000000000..0e282d97dd --- /dev/null +++ b/src/platformsupport/eventdispatchers/fontdatabases.pri @@ -0,0 +1,10 @@ +DEFINES += QT_COMPILES_IN_HARFBUZZ +INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/harfbuzz/src + +unix { + include($$PWD/basicunix/basicunix.pri) + include($$PWD/genericunix/genericunix.pri) + contains(QT_CONFIG,fontconfig) { + include($$PWD/fontconfig/fontconfig.pri) + } +} diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp b/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp index eea0b9333e..39b14e32af 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa.cpp +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qeventdispatcher_glib_qpa_p.h" +#include "qeventdispatcher_glib_p.h" #include "qguiapplication.h" diff --git a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h index ec9bb5e0ef..8a34e78357 100644 --- a/src/gui/kernel/qeventdispatcher_glib_qpa_p.h +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp index e850dda97b..e6bd4c7f6b 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage diff --git a/src/gui/kernel/qeventdispatcher_qpa_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h index fde3e47262..b49510efde 100644 --- a/src/gui/kernel/qeventdispatcher_qpa_p.h +++ b/src/platformsupport/eventdispatchers/qeventdispatcher_qpa_p.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QEVENTDISPATCHER_QPA_P_H -#define QEVENTDISPATCHER_QPA_P_H +#ifndef QEVENTDISPATCHER_QPA_H +#define QEVENTDISPATCHER_QPA_H // // W A R N I N G @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE class QEventDispatcherQPAPrivate; -class QEventDispatcherQPA : public EVENTDISPATCHERBASE +class Q_GUI_EXPORT QEventDispatcherQPA : public EVENTDISPATCHERBASE { Q_OBJECT Q_DECLARE_PRIVATE(QEventDispatcherQPA) @@ -84,7 +84,7 @@ public: void flush(); }; -class QEventDispatcherQPAPrivate : public EVENTDISPATCHERBASEPRIVATE +class Q_GUI_EXPORT QEventDispatcherQPAPrivate : public EVENTDISPATCHERBASEPRIVATE { Q_DECLARE_PUBLIC(QEventDispatcherQPA) public: @@ -94,4 +94,4 @@ public: QT_END_NAMESPACE -#endif // QEVENTDISPATCHER_QPA_P_H +#endif // QEVENTDISPATCHER_QPA_H diff --git a/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp new file mode 100644 index 0000000000..12981c5721 --- /dev/null +++ b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgenericunixeventdispatcher_p.h" +#include "qeventdispatcher_qpa_p.h" +#include "qeventdispatcher_glib_p.h" +#include <qglobal.h> + +class QAbstractEventDispatcher *createUnixEventDispatcher() +{ +#if !defined(QT_NO_GLIB) && !defined(Q_OS_WIN) + if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported()) + return new QPAEventDispatcherGlib(); + else +#endif + return new QEventDispatcherQPA(); +} diff --git a/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h new file mode 100644 index 0000000000..d8f02a12ad --- /dev/null +++ b/src/platformsupport/eventdispatchers/qgenericunixeventdispatcher_p.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +class QAbstractEventDispatcher; +#ifdef Q_OS_MAC +Q_GUI_EXPORT QAbstractEventDispatcher* createUnixEventDispatcher(); +#else +Q_GUI_EXPORT QAbstractEventDispatcher* createUnixEventDispatcher(); +#endif
\ No newline at end of file diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index e808cbd404..d51ffaa751 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -7,7 +7,7 @@ DESTDIR = $$QMAKE_LIBDIR_QT CONFIG += module !mac:CONFIG += staticlib -mac:LIBS+=-lz +mac:LIBS += -lz -framework CoreFoundation -framework Carbon MODULE_PRI = ../modules/qt_platformssupport.pri @@ -22,6 +22,7 @@ PRECOMPILED_HEADER = ../corelib/global/qt_pch.h include(dnd/dnd.pri) include(eglconvenience/eglconvenience.pri) +include(eventdispatchers/eventdispatchers.pri) include(fb_base/fb_base.pri) include(fontdatabases/fontdatabases.pri) include(glxconvenience/glxconvenience.pri) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 489e633674..5ff494aba6 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -2,7 +2,7 @@ TARGET = qcocoa load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms -OBJECTIVE_SOURCES = main.mm \ +OBJECTIVE_SOURCES += main.mm \ qcocoaintegration.mm \ qcocoabackingstore.mm \ qcocoawindow.mm \ @@ -10,23 +10,24 @@ OBJECTIVE_SOURCES = main.mm \ qcocoaautoreleasepool.mm \ qnswindowdelegate.mm \ qcocoaglcontext.mm \ - qcocoanativeinterface.mm + qcocoanativeinterface.mm \ + qcocoaeventdispatcher.mm - -OBJECTIVE_HEADERS = qcocoaintegration.h \ +HEADERS += qcocoaintegration.h \ qcocoabackingstore.h \ qcocoawindow.h \ qnsview.h \ qcocoaautoreleasepool.h \ qnswindowdelegate.h \ qcocoaglcontext.h \ - qcocoanativeinterface.h + qcocoanativeinterface.h \ + qcocoaeventdispatcher.h DEFINES += QT_BUILD_COCOA_LIB #add libz for freetype. LIBS += -lz -LIBS += -framework cocoa +LIBS += -framework cocoa -framework Carbon QT += core-private gui-private platformsupport-private diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h index 21a3830a43..ae2182ef65 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -87,12 +87,10 @@ // We mean it. // -#include <QtGui/qwindowdefs.h> #include <QtCore/qhash.h> #include <QtCore/qstack.h> -#include "private/qabstracteventdispatcher_p.h" -#include <private/qeventdispatcher_qpa_p.h> -//#include "private/qt_mac_p.h" +#include <QtGui/qwindowdefs.h> +#include <qeventdispatcher_qpa.h> #include <CoreFoundation/CoreFoundation.h> @@ -116,16 +114,16 @@ public: inline void *handle() const { return pool; } }; -class QEventDispatcherMacPrivate; -class QEventDispatcherMac : public QEventDispatcherQPA +class QCocoaEventDispatcherPrivate; +class QCocoaEventDispatcher : public QEventDispatcherQPA { Q_OBJECT - Q_DECLARE_PRIVATE(QEventDispatcherMac) + Q_DECLARE_PRIVATE(QCocoaEventDispatcher) public: - QEventDispatcherMac(QAbstractEventDispatcherPrivate &priv, QObject *parent = 0); - explicit QEventDispatcherMac(QObject *parent = 0); - ~QEventDispatcherMac(); + QCocoaEventDispatcher(QAbstractEventDispatcherPrivate &priv, QObject *parent = 0); + explicit QCocoaEventDispatcher(QObject *parent = 0); + ~QCocoaEventDispatcher(); bool processEvents(QEventLoop::ProcessEventsFlags flags); @@ -169,12 +167,12 @@ struct MacSocketInfo { }; typedef QHash<int, MacSocketInfo *> MacSocketHash; -class QEventDispatcherMacPrivate : public QEventDispatcherQPAPrivate +class QCocoaEventDispatcherPrivate : public QEventDispatcherQPAPrivate { - Q_DECLARE_PUBLIC(QEventDispatcherMac) + Q_DECLARE_PUBLIC(QCocoaEventDispatcher) public: - QEventDispatcherMacPrivate(); + QCocoaEventDispatcherPrivate(); static MacTimerHash macTimerHash; // Set 'blockSendPostedEvents' to true if you _really_ need @@ -198,7 +196,7 @@ public: static void ensureNSAppInitialized(); MacSocketHash macSockets; - QList<void *> queuedUserInputEvents; // List of EventRef in Carbon, and NSEvent * in Cocoa + QList<void *> queuedUserInputEvents; // NSEvent * CFRunLoopSourceRef postedEventsSource; CFRunLoopObserverRef waitingObserver; CFRunLoopObserverRef firstTimeObserver; @@ -212,16 +210,16 @@ private: static void waitingObserverCallback(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info); static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info); - friend void processPostedEvents(QEventDispatcherMacPrivate *const d, const bool blockSendPostedEvents); + friend void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents); }; -class QtMacInterruptDispatcherHelp : public QObject +class QtCocoaInterruptDispatcher : public QObject { - static QtMacInterruptDispatcherHelp *instance; + static QtCocoaInterruptDispatcher *instance; bool cancelled; - QtMacInterruptDispatcherHelp(); - ~QtMacInterruptDispatcherHelp(); + QtCocoaInterruptDispatcher(); + ~QtCocoaInterruptDispatcher(); public: static void interruptLater(); diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm index 7350984db7..b5cbc83029 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage @@ -73,7 +73,7 @@ ** ****************************************************************************/ -#include "qeventdispatcher_mac_p.h" +#include "qcocoaeventdispatcher.h" #include "qguiapplication.h" #include "qevent.h" #include "qhash.h" @@ -119,7 +119,7 @@ QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() *****************************************************************************/ /* timer call back */ -void QEventDispatcherMacPrivate::activateTimer(CFRunLoopTimerRef, void *info) +void QCocoaEventDispatcherPrivate::activateTimer(CFRunLoopTimerRef, void *info) { int timerID = #ifdef Q_OS_MAC64 @@ -149,7 +149,7 @@ void QEventDispatcherMacPrivate::activateTimer(CFRunLoopTimerRef, void *info) } -void QEventDispatcherMac::registerTimer(int timerId, int interval, QObject *obj) +void QCocoaEventDispatcher::registerTimer(int timerId, int interval, QObject *obj) { #ifndef QT_NO_DEBUG if (timerId < 1 || interval < 0 || !obj) { @@ -171,17 +171,17 @@ void QEventDispatcherMac::registerTimer(int timerId, int interval, QObject *obj) CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent(); CFTimeInterval cfinterval = qMax(CFTimeInterval(interval) / 1000, 0.0000001); fireDate += cfinterval; - QEventDispatcherMacPrivate::macTimerHash.insert(timerId, t); + QCocoaEventDispatcherPrivate::macTimerHash.insert(timerId, t); CFRunLoopTimerContext info = { 0, (void *)timerId, 0, 0, 0 }; t->runLoopTimer = CFRunLoopTimerCreate(0, fireDate, cfinterval, 0, 0, - QEventDispatcherMacPrivate::activateTimer, &info); + QCocoaEventDispatcherPrivate::activateTimer, &info); if (t->runLoopTimer == 0) { qFatal("QEventDispatcherMac::registerTimer: Cannot create timer"); } CFRunLoopAddTimer(mainRunLoop(), t->runLoopTimer, kCFRunLoopCommonModes); } -bool QEventDispatcherMac::unregisterTimer(int identifier) +bool QCocoaEventDispatcher::unregisterTimer(int identifier) { #ifndef QT_NO_DEBUG if (identifier < 1) { @@ -195,7 +195,7 @@ bool QEventDispatcherMac::unregisterTimer(int identifier) if (identifier <= 0) return false; // not init'd or invalid timer - MacTimerInfo *timerInfo = QEventDispatcherMacPrivate::macTimerHash.take(identifier); + MacTimerInfo *timerInfo = QCocoaEventDispatcherPrivate::macTimerHash.take(identifier); if (timerInfo == 0) return false; @@ -208,7 +208,7 @@ bool QEventDispatcherMac::unregisterTimer(int identifier) return true; } -bool QEventDispatcherMac::unregisterTimers(QObject *obj) +bool QCocoaEventDispatcher::unregisterTimers(QObject *obj) { #ifndef QT_NO_DEBUG if (!obj) { @@ -220,8 +220,8 @@ bool QEventDispatcherMac::unregisterTimers(QObject *obj) } #endif - MacTimerHash::iterator it = QEventDispatcherMacPrivate::macTimerHash.begin(); - while (it != QEventDispatcherMacPrivate::macTimerHash.end()) { + MacTimerHash::iterator it = QCocoaEventDispatcherPrivate::macTimerHash.begin(); + while (it != QCocoaEventDispatcherPrivate::macTimerHash.end()) { MacTimerInfo *timerInfo = it.value(); if (timerInfo->obj != obj) { ++it; @@ -231,14 +231,14 @@ bool QEventDispatcherMac::unregisterTimers(QObject *obj) CFRunLoopTimerInvalidate(timerInfo->runLoopTimer); CFRelease(timerInfo->runLoopTimer); delete timerInfo; - it = QEventDispatcherMacPrivate::macTimerHash.erase(it); + it = QCocoaEventDispatcherPrivate::macTimerHash.erase(it); } } return true; } -QList<QEventDispatcherMac::TimerInfo> -QEventDispatcherMac::registeredTimers(QObject *object) const +QList<QCocoaEventDispatcher::TimerInfo> +QCocoaEventDispatcher::registeredTimers(QObject *object) const { if (!object) { qWarning("QEventDispatcherMac:registeredTimers: invalid argument"); @@ -247,8 +247,8 @@ QEventDispatcherMac::registeredTimers(QObject *object) const QList<TimerInfo> list; - MacTimerHash::const_iterator it = QEventDispatcherMacPrivate::macTimerHash.constBegin(); - while (it != QEventDispatcherMacPrivate::macTimerHash.constEnd()) { + MacTimerHash::const_iterator it = QCocoaEventDispatcherPrivate::macTimerHash.constBegin(); + while (it != QCocoaEventDispatcherPrivate::macTimerHash.constEnd()) { MacTimerInfo *t = it.value(); if (t->obj == object) list << TimerInfo(t->id, t->interval); @@ -262,8 +262,8 @@ QEventDispatcherMac::registeredTimers(QObject *object) const *************************************************************************/ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef, const void *, void *info) { - QEventDispatcherMacPrivate *const eventDispatcher - = static_cast<QEventDispatcherMacPrivate *>(info); + QCocoaEventDispatcherPrivate *const eventDispatcher + = static_cast<QCocoaEventDispatcherPrivate *>(info); int nativeSocket = CFSocketGetNative(s); MacSocketInfo *socketInfo = eventDispatcher->macSockets.value(nativeSocket); QEvent notifierEvent(QEvent::SockAct); @@ -314,7 +314,7 @@ void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSource Qt has separate socket notifiers for reading and writing, but on the mac there is a limitation of one CFSocket object for each native socket. */ -void QEventDispatcherMac::registerSocketNotifier(QSocketNotifier *notifier) +void QCocoaEventDispatcher::registerSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); int nativeSocket = notifier->socket(); @@ -330,7 +330,7 @@ void QEventDispatcherMac::registerSocketNotifier(QSocketNotifier *notifier) } #endif - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); if (type == QSocketNotifier::Exception) { qWarning("QSocketNotifier::Exception is not supported on Mac OS X"); @@ -391,7 +391,7 @@ void QEventDispatcherMac::registerSocketNotifier(QSocketNotifier *notifier) removed from the runloop of this is the last notifier that users that CFSocket. */ -void QEventDispatcherMac::unregisterSocketNotifier(QSocketNotifier *notifier) +void QCocoaEventDispatcher::unregisterSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); int nativeSocket = notifier->socket(); @@ -406,7 +406,7 @@ void QEventDispatcherMac::unregisterSocketNotifier(QSocketNotifier *notifier) } #endif - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); if (type == QSocketNotifier::Exception) { qWarning("QSocketNotifier::Exception is not supported on Mac OS X"); @@ -442,7 +442,7 @@ void QEventDispatcherMac::unregisterSocketNotifier(QSocketNotifier *notifier) } } -bool QEventDispatcherMac::hasPendingEvents() +bool QCocoaEventDispatcher::hasPendingEvents() { extern uint qGlobalPostedEventsCount(); extern bool qt_is_gui_used; //qapplication.cpp @@ -521,13 +521,13 @@ static inline void qt_mac_waitForMoreModalSessionEvents() [NSApp postEvent:event atStart:YES]; } -bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) +bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) { - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); d->interrupt = false; bool interruptLater = false; - QtMacInterruptDispatcherHelp::cancelInterruptLater(); + QtCocoaInterruptDispatcher::cancelInterruptLater(); // In case we end up recursing while we now process events, make sure // that we send remaining posted Qt events before this call returns: @@ -686,14 +686,14 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) interrupt(); if (interruptLater) - QtMacInterruptDispatcherHelp::interruptLater(); + QtCocoaInterruptDispatcher::interruptLater(); return retVal; } -void QEventDispatcherMac::wakeUp() +void QCocoaEventDispatcher::wakeUp() { - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); d->serialNumber.ref(); CFRunLoopSourceSignal(d->postedEventsSource); CFRunLoopWakeUp(mainRunLoop()); @@ -702,18 +702,18 @@ void QEventDispatcherMac::wakeUp() /***************************************************************************** QEventDispatcherMac Implementation *****************************************************************************/ -MacTimerHash QEventDispatcherMacPrivate::macTimerHash; -bool QEventDispatcherMacPrivate::blockSendPostedEvents = false; -bool QEventDispatcherMacPrivate::interrupt = false; +MacTimerHash QCocoaEventDispatcherPrivate::macTimerHash; +bool QCocoaEventDispatcherPrivate::blockSendPostedEvents = false; +bool QCocoaEventDispatcherPrivate::interrupt = false; -QStack<QCocoaModalSessionInfo> QEventDispatcherMacPrivate::cocoaModalSessionStack; -bool QEventDispatcherMacPrivate::currentExecIsNSAppRun = false; -bool QEventDispatcherMacPrivate::nsAppRunCalledByQt = false; -bool QEventDispatcherMacPrivate::cleanupModalSessionsNeeded = false; -NSModalSession QEventDispatcherMacPrivate::currentModalSessionCached = 0; +QStack<QCocoaModalSessionInfo> QCocoaEventDispatcherPrivate::cocoaModalSessionStack; +bool QCocoaEventDispatcherPrivate::currentExecIsNSAppRun = false; +bool QCocoaEventDispatcherPrivate::nsAppRunCalledByQt = false; +bool QCocoaEventDispatcherPrivate::cleanupModalSessionsNeeded = false; +NSModalSession QCocoaEventDispatcherPrivate::currentModalSessionCached = 0; -void QEventDispatcherMacPrivate::ensureNSAppInitialized() +void QCocoaEventDispatcherPrivate::ensureNSAppInitialized() { // Some elements in Cocoa require NSApplication to be running before // they get fully initialized, in particular the menu bar. This @@ -733,7 +733,7 @@ void QEventDispatcherMacPrivate::ensureNSAppInitialized() [NSApp run]; } -void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() +void QCocoaEventDispatcherPrivate::temporarilyStopAllModalSessions() { // Flush, and Stop, all created modal session, and as // such, make them pending again. The next call to @@ -755,7 +755,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() currentModalSessionCached = 0; } -NSModalSession QEventDispatcherMacPrivate::currentModalSession() +NSModalSession QCocoaEventDispatcherPrivate::currentModalSession() { // If we have one or more modal windows, this function will create // a session for each of those, and return the one for the top. @@ -816,7 +816,7 @@ static void setChildrenWorksWhenModal(QWindow *window, bool worksWhenModal) */ } -void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal() +void QCocoaEventDispatcherPrivate::updateChildrenWorksWhenModal() { // Make the dialog children of the window // active. And make the dialog children of @@ -833,7 +833,7 @@ void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal() } } -void QEventDispatcherMacPrivate::cleanupModalSessions() +void QCocoaEventDispatcherPrivate::cleanupModalSessions() { // Go through the list of modal sessions, and end those // that no longer has a window assosiated; no window means @@ -867,7 +867,7 @@ void QEventDispatcherMacPrivate::cleanupModalSessions() cleanupModalSessionsNeeded = false; } -void QEventDispatcherMacPrivate::beginModalSession(QWindow *window) +void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window) { // Add a new, empty (null), NSModalSession to the stack. // It will become active the next time QEventDispatcher::processEvents is called. @@ -882,7 +882,7 @@ void QEventDispatcherMacPrivate::beginModalSession(QWindow *window) currentModalSessionCached = 0; } -void QEventDispatcherMacPrivate::endModalSession(QWindow *window) +void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window) { // Mark all sessions attached to window as pending to be stopped. We do this // by setting the window pointer to zero, but leave the session pointer. @@ -899,25 +899,25 @@ void QEventDispatcherMacPrivate::endModalSession(QWindow *window) // to start spinning the correct session immidiatly: currentModalSessionCached = 0; cleanupModalSessionsNeeded = true; - QEventDispatcherMac::instance()->interrupt(); + QCocoaEventDispatcher::instance()->interrupt(); } } } } -QEventDispatcherMacPrivate::QEventDispatcherMacPrivate() +QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate() { } -QEventDispatcherMac::QEventDispatcherMac(QObject *parent) - : QEventDispatcherQPA(*new QEventDispatcherMacPrivate, parent) +QCocoaEventDispatcher::QCocoaEventDispatcher(QObject *parent) + : QEventDispatcherQPA(*new QCocoaEventDispatcherPrivate, parent) { - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); CFRunLoopSourceContext context; bzero(&context, sizeof(CFRunLoopSourceContext)); context.info = d; - context.equal = QEventDispatcherMacPrivate::postedEventSourceEqualCallback; - context.perform = QEventDispatcherMacPrivate::postedEventsSourcePerformCallback; + context.equal = QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback; + context.perform = QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback; d->postedEventsSource = CFRunLoopSourceCreate(0, 0, &context); Q_ASSERT(d->postedEventsSource); CFRunLoopAddSource(mainRunLoop(), d->postedEventsSource, kCFRunLoopCommonModes); @@ -928,7 +928,7 @@ QEventDispatcherMac::QEventDispatcherMac(QObject *parent) d->waitingObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeWaiting | kCFRunLoopAfterWaiting, true, 0, - QEventDispatcherMacPrivate::waitingObserverCallback, + QCocoaEventDispatcherPrivate::waitingObserverCallback, &observerContext); CFRunLoopAddObserver(mainRunLoop(), d->waitingObserver, kCFRunLoopCommonModes); @@ -943,26 +943,26 @@ QEventDispatcherMac::QEventDispatcherMac(QObject *parent) kCFRunLoopEntry, /* repeats = */ false, 0, - QEventDispatcherMacPrivate::firstLoopEntry, + QCocoaEventDispatcherPrivate::firstLoopEntry, &firstTimeObserverContext); CFRunLoopAddObserver(mainRunLoop(), d->firstTimeObserver, kCFRunLoopCommonModes); } -void QEventDispatcherMacPrivate::waitingObserverCallback(CFRunLoopObserverRef, +void QCocoaEventDispatcherPrivate::waitingObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity activity, void *info) { if (activity == kCFRunLoopBeforeWaiting) - emit static_cast<QEventDispatcherMac*>(info)->aboutToBlock(); + emit static_cast<QCocoaEventDispatcher*>(info)->aboutToBlock(); else - emit static_cast<QEventDispatcherMac*>(info)->awake(); + emit static_cast<QCocoaEventDispatcher*>(info)->awake(); } -Boolean QEventDispatcherMacPrivate::postedEventSourceEqualCallback(const void *info1, const void *info2) +Boolean QCocoaEventDispatcherPrivate::postedEventSourceEqualCallback(const void *info1, const void *info2) { return info1 == info2; } -void processPostedEvents(QEventDispatcherMacPrivate *const d, const bool blockSendPostedEvents) +void processPostedEvents(QCocoaEventDispatcherPrivate *const d, const bool blockSendPostedEvents) { if (blockSendPostedEvents) { // We're told to not send posted events (because the event dispatcher @@ -998,7 +998,7 @@ void processPostedEvents(QEventDispatcherMacPrivate *const d, const bool blockSe } } -void QEventDispatcherMacPrivate::firstLoopEntry(CFRunLoopObserverRef ref, +void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info) { @@ -1024,15 +1024,15 @@ void QEventDispatcherMacPrivate::firstLoopEntry(CFRunLoopObserverRef ref, forEventClass:kInternetEventClass andEventID:kAEGetURL]; */ - processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents); + processPostedEvents(static_cast<QCocoaEventDispatcherPrivate *>(info), blockSendPostedEvents); } -void QEventDispatcherMacPrivate::postedEventsSourcePerformCallback(void *info) +void QCocoaEventDispatcherPrivate::postedEventsSourcePerformCallback(void *info) { - processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents); + processPostedEvents(static_cast<QCocoaEventDispatcherPrivate *>(info), blockSendPostedEvents); } -void QEventDispatcherMacPrivate::cancelWaitForMoreEvents() +void QCocoaEventDispatcherPrivate::cancelWaitForMoreEvents() { // In case the event dispatcher is waiting for more // events somewhere, we post a dummy event to wake it up: @@ -1042,9 +1042,9 @@ void QEventDispatcherMacPrivate::cancelWaitForMoreEvents() subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO]; } -void QEventDispatcherMac::interrupt() +void QCocoaEventDispatcher::interrupt() { - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); d->interrupt = true; wakeUp(); @@ -1058,12 +1058,12 @@ void QEventDispatcherMac::interrupt() d->cancelWaitForMoreEvents(); } -QEventDispatcherMac::~QEventDispatcherMac() +QCocoaEventDispatcher::~QCocoaEventDispatcher() { - Q_D(QEventDispatcherMac); + Q_D(QCocoaEventDispatcher); //timer cleanup - MacTimerHash::iterator it = QEventDispatcherMacPrivate::macTimerHash.begin(); - while (it != QEventDispatcherMacPrivate::macTimerHash.end()) { + MacTimerHash::iterator it = QCocoaEventDispatcherPrivate::macTimerHash.begin(); + while (it != QCocoaEventDispatcherPrivate::macTimerHash.end()) { MacTimerInfo *t = it.value(); if (t->runLoopTimer) { CFRunLoopTimerInvalidate(t->runLoopTimer); @@ -1072,7 +1072,7 @@ QEventDispatcherMac::~QEventDispatcherMac() delete t; ++it; } - QEventDispatcherMacPrivate::macTimerHash.clear(); + QCocoaEventDispatcherPrivate::macTimerHash.clear(); // Remove CFSockets from the runloop. for (MacSocketHash::ConstIterator it = d->macSockets.constBegin(); it != d->macSockets.constEnd(); ++it) { @@ -1095,9 +1095,9 @@ QEventDispatcherMac::~QEventDispatcherMac() CFRelease(d->firstTimeObserver); } -QtMacInterruptDispatcherHelp* QtMacInterruptDispatcherHelp::instance = 0; +QtCocoaInterruptDispatcher* QtCocoaInterruptDispatcher::instance = 0; -QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false) +QtCocoaInterruptDispatcher::QtCocoaInterruptDispatcher() : cancelled(false) { // The whole point of this class is that we enable a way to interrupt // the event dispatcher when returning back to a lower recursion level @@ -1108,15 +1108,15 @@ QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false) deleteLater(); } -QtMacInterruptDispatcherHelp::~QtMacInterruptDispatcherHelp() +QtCocoaInterruptDispatcher::~QtCocoaInterruptDispatcher() { if (cancelled) return; instance = 0; - QEventDispatcherMac::instance()->interrupt(); + QCocoaEventDispatcher::instance()->interrupt(); } -void QtMacInterruptDispatcherHelp::cancelInterruptLater() +void QtCocoaInterruptDispatcher::cancelInterruptLater() { if (!instance) return; @@ -1125,10 +1125,10 @@ void QtMacInterruptDispatcherHelp::cancelInterruptLater() instance = 0; } -void QtMacInterruptDispatcherHelp::interruptLater() +void QtCocoaInterruptDispatcher::interruptLater() { cancelInterruptLater(); - instance = new QtMacInterruptDispatcherHelp; + instance = new QtCocoaInterruptDispatcher; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 56864a4d57..031d4056fb 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -80,6 +80,7 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const { return mScreens; } diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 474f3a3d5c..4d01aa0a80 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -45,6 +45,7 @@ #include "qcocoabackingstore.h" #include "qcocoanativeinterface.h" +#include "qcocoaeventdispatcher.h" #include <QtPlatformSupport/private/qbasicunixfontdatabase_p.h> #include <private/qpixmap_raster_p.h> @@ -122,6 +123,11 @@ QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *wi return new QCocoaBackingStore(window); } +QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const +{ + return new QCocoaEventDispatcher(); +} + QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const { return mFontDb; diff --git a/src/plugins/platforms/directfb/directfb.pro b/src/plugins/platforms/directfb/directfb.pro index f830177dcb..fb446f6166 100644 --- a/src/plugins/platforms/directfb/directfb.pro +++ b/src/plugins/platforms/directfb/directfb.pro @@ -2,6 +2,8 @@ TARGET = qdirectfb load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms +QT += core-private gui-private platformsupport-private + isEmpty(DIRECTFB_LIBS) { DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread } diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp index 61f1d2513b..018a5d9e2d 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp +++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp @@ -46,7 +46,8 @@ #include "qdirectfbcursor.h" #include "qdirectfbwindow.h" -#include "qgenericunixfontdatabase.h" +#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <private/qwindowsurface_raster_p.h> #include <private/qpixmap_raster_p.h> @@ -55,6 +56,7 @@ #include <QtGui/private/qpixmapdata_p.h> #include <QtCore/QCoreApplication> #include <QtCore/QThread> +#include <QtCore/QAbstractEventDispatcher> QT_BEGIN_NAMESPACE @@ -131,6 +133,11 @@ QPlatformWindow *QDirectFbIntegration::createPlatformWindow(QWidget *widget, WId return new QDirectFbWindow(widget,input); } +QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const { return new QDirectFbWindowSurface(widget,winId); diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h index 0e8337a5fb..8195ebd4b5 100644 --- a/src/plugins/platforms/directfb/qdirectfbintegration.h +++ b/src/plugins/platforms/directfb/qdirectfbintegration.h @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE class QThread; +class QAbstractEventDispatcher; class QDirectFBCursor; class QDirectFbScreen : public QPlatformScreen @@ -87,6 +88,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const { return mScreens; } diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index ce6814ecc1..9375486d8b 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -3,6 +3,8 @@ load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms +QT += core-private gui-private platformsupport-private + SOURCES = main.cpp qlinuxfbintegration.cpp HEADERS = qlinuxfbintegration.h diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 4a24d6614a..c2388ceb85 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -42,6 +42,7 @@ #include "qlinuxfbintegration.h" #include "../fb_base/fb_base.h" #include "qgenericunixfontdatabase.h" +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <QtGui/private/qpixmap_raster_p.h> #include <private/qcore_unix_p.h> // overrides QT_OPEN #include <qimage.h> @@ -810,6 +811,11 @@ QPlatformWindow *QLinuxFbIntegration::createPlatformWindow(QWidget *widget, WId return w; } +QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QPlatformFontDatabase *QLinuxFbIntegration::fontDatabase() const { return fontDb; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index b96749ff03..62c2a59187 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -70,6 +70,7 @@ class QLinuxFbIntegrationPrivate; struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; +class QAbstractEventDispatcher; class QLinuxFbIntegration : public QPlatformIntegration { @@ -82,6 +83,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const { return mScreens; } diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro index 53ae1b1319..392d12d19a 100644 --- a/src/plugins/platforms/minimal/minimal.pro +++ b/src/plugins/platforms/minimal/minimal.pro @@ -1,7 +1,7 @@ TARGET = qminimal load(qt_plugin) -QT = core-private gui-private +QT += core-private gui-private platformsupport-private DESTDIR = $$QT.gui.plugins/platforms SOURCES = main.cpp \ diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index c3300ce3b8..a12ac3657a 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -41,6 +41,7 @@ #include "qminimalintegration.h" #include "qminimalbackingstore.h" +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <QtGui/private/qpixmap_raster_p.h> #include <QtGui/QPlatformWindow> @@ -79,3 +80,9 @@ QPlatformBackingStore *QMinimalIntegration::createPlatformBackingStore(QWindow * { return new QMinimalBackingStore(window); } + +QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index efb0f352d4..dc111757db 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -73,7 +73,8 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const { return mScreens; } diff --git a/src/plugins/platforms/qvfb/qvfb.pro b/src/plugins/platforms/qvfb/qvfb.pro index 5db8533264..a95b13efc7 100644 --- a/src/plugins/platforms/qvfb/qvfb.pro +++ b/src/plugins/platforms/qvfb/qvfb.pro @@ -3,6 +3,7 @@ load(qt_plugin) DESTDIR = $$QT.gui.plugins/platforms +QT += core-private gui-private platformsupport-private SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp HEADERS = qvfbintegration.h qvfbwindowsurface.h diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 6b54420402..214f6a8368 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -63,6 +63,7 @@ #include <QWindowSystemInterface> #include "qgenericunixfontdatabase.h" +#include "qgenericunixeventdispatcher.h" QT_BEGIN_NAMESPACE @@ -438,6 +439,11 @@ QPlatformWindow *QVFbIntegration::createPlatformWindow(QWidget *widget, WId) con return new QVFbWindow(mPrimaryScreen, widget); } +QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QPlatformFontDatabase *QVFbIntegration::fontDatabase() const { return mFontDb; diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index ae3ba7bcc3..aaf20a37ec 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QVFbScreenPrivate; +class QAbstractEventDispatcher; class QVFbScreen : public QPlatformScreen { @@ -81,6 +82,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const { return mScreens; } diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 1e8c6c1bc5..459eefd599 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -173,6 +173,10 @@ QWindowSurface *QVNCIntegration::createWindowSurface(QWidget *widget, WId) const return surface; } +QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 3e13bc3b8d..dbdac51c73 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -74,7 +74,7 @@ private: }; class QVNCIntegrationPrivate; - +class QAbstractEventDispatcher; class QVNCIntegration : public QPlatformIntegration { @@ -85,6 +85,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QAbstractEventDispatcher createEventDispatcher() const; QPixmap grabWindow(WId window, int x, int y, int width, int height) const; diff --git a/src/plugins/platforms/vnc/vnc.pro b/src/plugins/platforms/vnc/vnc.pro index 85bffb0637..321cee4790 100644 --- a/src/plugins/platforms/vnc/vnc.pro +++ b/src/plugins/platforms/vnc/vnc.pro @@ -1,7 +1,7 @@ TARGET = qvncgraphicssystem load(qt_plugin) -QT += network +QT += network core-private gui-private platformsupport-private DESTDIR = $$QT.gui.plugins/platforms diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index dc59d37f40..bdd8235d5b 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -48,6 +48,7 @@ #include "qwaylandclipboard.h" #include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h" +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <QtGui/QWindowSystemInterface> #include <QtGui/QPlatformCursor> @@ -122,6 +123,11 @@ QPlatformBackingStore *QWaylandIntegration::createPlatformBackingStore(QWindow * return new QWaylandShmBackingStore(window); } +QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const { return mFontDb; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index adb8b81ca6..6a5e4d3b28 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE class QWaylandBuffer; class QWaylandDisplay; +class QAbstractEventDispatcher; class QWaylandIntegration : public QPlatformIntegration { @@ -59,6 +60,7 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const; diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 9010439939..dc4485ca33 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -42,3 +42,4 @@ INSTALLS += target include ($$PWD/gl_integration/gl_integration.pri) include ($$PWD/windowmanager_integration/windowmanager_integration.pri) +load(qpa/eventdispatchers/eventdispatchers) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index d5f7c70ad2..2513075f45 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -55,6 +55,7 @@ #include <private/qpixmap_raster_p.h> +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> #include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> #include <stdio.h> @@ -136,6 +137,11 @@ QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *wind return new QXcbBackingStore(window); } +QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} + QList<QPlatformScreen *> QXcbIntegration::screens() const { return m_screens; diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index a839b78caa..1f426ab4e7 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE class QXcbConnection; +class QAbstractEventDispatcher; class QXcbIntegration : public QPlatformIntegration { @@ -60,6 +61,7 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformGLContext *createPlatformGLContext(const QSurfaceFormat &glFormat, QPlatformGLContext *share) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; + QAbstractEventDispatcher *createEventDispatcher() const; QList<QPlatformScreen *> screens() const; void moveToScreen(QWindow *window, int screen); diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 02104d9f74..f659d439ec 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -45,7 +45,8 @@ #include <QtCore/qdebug.h> #include "qxlibwindow.h" -#include "qgenericunixfontdatabase.h" +#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> +#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> #include "qxlibscreen.h" #include "qxlibclipboard.h" #include "qxlibdisplay.h" @@ -106,7 +107,10 @@ QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*w return new QXlibWindow(widget); } - +QAbstractEventDispatcher *QXlibIntegration::createEventDispatcher() const +{ + return createUnixEventDispatcher(); +} QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const { diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index 9c814ead69..ce5f35a41d 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -64,6 +64,7 @@ public: QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + QAbstractEventDispatcher *createEventDispatcher() const; QPixmap grabWindow(WId window, int x, int y, int width, int height) const; diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index b6d0e0bf27..0c97d31f11 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -3,7 +3,7 @@ TARGET = qxlib load(qpa/plugin) DESTDIR = $$QT.gui.plugins/platforms -QT += core-private gui-private opengl-private +QT += core-private gui-private opengl-private platformsupport-private SOURCES = \ main.cpp \ diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index aef8f5ae58..649e0ad2b7 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -42,10 +42,6 @@ #include "qapplication_p.h" #include "qcolormap.h" #include "qpixmapcache.h" -#if !defined(QT_NO_GLIB) -#include "private/qeventdispatcher_glib_qpa_p.h" -#endif -#include "private/qeventdispatcher_qpa_p.h" #ifndef QT_NO_CURSOR #include "private/qcursor_p.h" #endif |