Add lighthouse event dispatcher API.
Platform plugin creation is now moved forward in order to have a platform plugin instance at event dispatcher creation time. Plugins are now responsible for implementing PlatformIntegration::createEventDispatcher and returning an QAbstractEventDispatcher subclass.
This commit is contained in:
parent
18c1d67137
commit
4efaf305f5
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
void QGuiApplicationPrivate::createPlatformIntegration()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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...
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
QGuiApplicationPrivate(int &argc, char **argv, int flags);
|
||||
~QGuiApplicationPrivate();
|
||||
|
||||
void createPlatformIntegration();
|
||||
void createEventDispatcher();
|
||||
|
||||
virtual void notifyLayoutDirectionChange();
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -47,7 +47,7 @@ QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QWindowSystemInterfacePrivate {
|
||||
class Q_GUI_EXPORT QWindowSystemInterfacePrivate {
|
||||
public:
|
||||
enum EventType {
|
||||
Close,
|
||||
|
16
src/platformsupport/eventdispatchers/eventdispatchers.pri
Normal file
16
src/platformsupport/eventdispatchers/eventdispatchers.pri
Normal file
@ -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
|
||||
}
|
10
src/platformsupport/eventdispatchers/fontdatabases.pri
Normal file
10
src/platformsupport/eventdispatchers/fontdatabases.pri
Normal file
@ -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)
|
||||
}
|
||||
}
|
@ -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"
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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();
|
||||
}
|
@ -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
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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();
|
@ -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
|
@ -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; }
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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; }
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
TARGET = qvncgraphicssystem
|
||||
load(qt_plugin)
|
||||
|
||||
QT += network
|
||||
QT += network core-private gui-private platformsupport-private
|
||||
|
||||
DESTDIR = $$QT.gui.plugins/platforms
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -42,3 +42,4 @@ INSTALLS += target
|
||||
|
||||
include ($$PWD/gl_integration/gl_integration.pri)
|
||||
include ($$PWD/windowmanager_integration/windowmanager_integration.pri)
|
||||
load(qpa/eventdispatchers/eventdispatchers)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user