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;
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 \
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 \
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
#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>
}
}
-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
} 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") {
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...
QGuiApplicationPrivate(int &argc, char **argv, int flags);
~QGuiApplicationPrivate();
+ void createPlatformIntegration();
void createEventDispatcher();
virtual void notifyLayoutDirectionChange();
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
{
class QPlatformDrag;
class QPlatformGLContext;
class QGuiGLFormat;
+class QAbstractEventDispatcher;
class Q_GUI_EXPORT QPlatformIntegration
{
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
QT_BEGIN_NAMESPACE
-class QWindowSystemInterfacePrivate {
+class Q_GUI_EXPORT QWindowSystemInterfacePrivate {
public:
enum EventType {
Close,
--- /dev/null
+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
--- /dev/null
+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)
+ }
+}
** 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
**
****************************************************************************/
-#include "qeventdispatcher_glib_qpa_p.h"
+#include "qeventdispatcher_glib_p.h"
#include "qguiapplication.h"
** 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
** 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
** 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
**
****************************************************************************/
-#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
class QEventDispatcherQPAPrivate;
-class QEventDispatcherQPA : public EVENTDISPATCHERBASE
+class Q_GUI_EXPORT QEventDispatcherQPA : public EVENTDISPATCHERBASE
{
Q_OBJECT
Q_DECLARE_PRIVATE(QEventDispatcherQPA)
void flush();
};
-class QEventDispatcherQPAPrivate : public EVENTDISPATCHERBASEPRIVATE
+class Q_GUI_EXPORT QEventDispatcherQPAPrivate : public EVENTDISPATCHERBASEPRIVATE
{
Q_DECLARE_PUBLIC(QEventDispatcherQPA)
public:
QT_END_NAMESPACE
-#endif // QEVENTDISPATCHER_QPA_P_H
+#endif // QEVENTDISPATCHER_QPA_H
--- /dev/null
+/****************************************************************************
+**
+** 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();
+}
--- /dev/null
+/****************************************************************************
+**
+** 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
CONFIG += module
!mac:CONFIG += staticlib
-mac:LIBS+=-lz
+mac:LIBS += -lz -framework CoreFoundation -framework Carbon
MODULE_PRI = ../modules/qt_platformssupport.pri
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)
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
-OBJECTIVE_SOURCES = main.mm \
+OBJECTIVE_SOURCES += main.mm \
qcocoaintegration.mm \
qcocoabackingstore.mm \
qcocoawindow.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
** 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
// 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>
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);
};
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
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;
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();
** 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
**
****************************************************************************/
-#include "qeventdispatcher_mac_p.h"
+#include "qcocoaeventdispatcher.h"
#include "qguiapplication.h"
#include "qevent.h"
#include "qhash.h"
*****************************************************************************/
/* timer call back */
-void QEventDispatcherMacPrivate::activateTimer(CFRunLoopTimerRef, void *info)
+void QCocoaEventDispatcherPrivate::activateTimer(CFRunLoopTimerRef, void *info)
{
int timerID =
#ifdef Q_OS_MAC64
}
-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) {
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) {
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;
return true;
}
-bool QEventDispatcherMac::unregisterTimers(QObject *obj)
+bool QCocoaEventDispatcher::unregisterTimers(QObject *obj)
{
#ifndef QT_NO_DEBUG
if (!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;
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");
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);
*************************************************************************/
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);
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();
}
#endif
- Q_D(QEventDispatcherMac);
+ Q_D(QCocoaEventDispatcher);
if (type == QSocketNotifier::Exception) {
qWarning("QSocketNotifier::Exception is not supported on Mac OS X");
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();
}
#endif
- Q_D(QEventDispatcherMac);
+ Q_D(QCocoaEventDispatcher);
if (type == QSocketNotifier::Exception) {
qWarning("QSocketNotifier::Exception is not supported on Mac OS X");
}
}
-bool QEventDispatcherMac::hasPendingEvents()
+bool QCocoaEventDispatcher::hasPendingEvents()
{
extern uint qGlobalPostedEventsCount();
extern bool qt_is_gui_used; //qapplication.cpp
[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:
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());
/*****************************************************************************
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
[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
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.
*/
}
-void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal()
+void QCocoaEventDispatcherPrivate::updateChildrenWorksWhenModal()
{
// Make the dialog children of the window
// active. And make the dialog children of
}
}
-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
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.
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.
// 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);
d->waitingObserver = CFRunLoopObserverCreate(kCFAllocatorDefault,
kCFRunLoopBeforeWaiting | kCFRunLoopAfterWaiting,
true, 0,
- QEventDispatcherMacPrivate::waitingObserverCallback,
+ QCocoaEventDispatcherPrivate::waitingObserverCallback,
&observerContext);
CFRunLoopAddObserver(mainRunLoop(), d->waitingObserver, kCFRunLoopCommonModes);
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
}
}
-void QEventDispatcherMacPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
+void QCocoaEventDispatcherPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
CFRunLoopActivity activity,
void *info)
{
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:
subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
}
-void QEventDispatcherMac::interrupt()
+void QCocoaEventDispatcher::interrupt()
{
- Q_D(QEventDispatcherMac);
+ Q_D(QCocoaEventDispatcher);
d->interrupt = true;
wakeUp();
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);
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) {
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
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;
instance = 0;
}
-void QtMacInterruptDispatcherHelp::interruptLater()
+void QtCocoaInterruptDispatcher::interruptLater()
{
cancelInterruptLater();
- instance = new QtMacInterruptDispatcherHelp;
+ instance = new QtCocoaInterruptDispatcher;
}
QT_END_NAMESPACE
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; }
#include "qcocoabackingstore.h"
#include "qcocoanativeinterface.h"
+#include "qcocoaeventdispatcher.h"
#include <QtPlatformSupport/private/qbasicunixfontdatabase_p.h>
#include <private/qpixmap_raster_p.h>
return new QCocoaBackingStore(window);
}
+QAbstractEventDispatcher *QCocoaIntegration::createEventDispatcher() const
+{
+ return new QCocoaEventDispatcher();
+}
+
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
{
return mFontDb;
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/platforms
+QT += core-private gui-private platformsupport-private
+
isEmpty(DIRECTFB_LIBS) {
DIRECTFB_LIBS = -ldirectfb -lfusion -ldirect -lpthread
}
#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>
#include <QtGui/private/qpixmapdata_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QThread>
+#include <QtCore/QAbstractEventDispatcher>
QT_BEGIN_NAMESPACE
return new QDirectFbWindow(widget,input);
}
+QAbstractEventDispatcher *QDirectFbIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
QWindowSurface *QDirectFbIntegration::createWindowSurface(QWidget *widget, WId winId) const
{
return new QDirectFbWindowSurface(widget,winId);
QT_BEGIN_NAMESPACE
class QThread;
+class QAbstractEventDispatcher;
class QDirectFBCursor;
class QDirectFbScreen : public QPlatformScreen
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; }
DESTDIR = $$QT.gui.plugins/platforms
+QT += core-private gui-private platformsupport-private
+
SOURCES = main.cpp qlinuxfbintegration.cpp
HEADERS = qlinuxfbintegration.h
#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>
return w;
}
+QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
QPlatformFontDatabase *QLinuxFbIntegration::fontDatabase() const
{
return fontDb;
struct fb_cmap;
struct fb_var_screeninfo;
struct fb_fix_screeninfo;
+class QAbstractEventDispatcher;
class QLinuxFbIntegration : public QPlatformIntegration
{
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; }
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 \
#include "qminimalintegration.h"
#include "qminimalbackingstore.h"
+#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtGui/private/qpixmap_raster_p.h>
#include <QtGui/QPlatformWindow>
{
return new QMinimalBackingStore(window);
}
+
+QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
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; }
DESTDIR = $$QT.gui.plugins/platforms
+QT += core-private gui-private platformsupport-private
SOURCES = main.cpp qvfbintegration.cpp qvfbwindowsurface.cpp
HEADERS = qvfbintegration.h qvfbwindowsurface.h
#include <QWindowSystemInterface>
#include "qgenericunixfontdatabase.h"
+#include "qgenericunixeventdispatcher.h"
QT_BEGIN_NAMESPACE
return new QVFbWindow(mPrimaryScreen, widget);
}
+QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
QPlatformFontDatabase *QVFbIntegration::fontDatabase() const
{
return mFontDb;
class QVFbScreenPrivate;
+class QAbstractEventDispatcher;
class QVFbScreen : public QPlatformScreen
{
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; }
return surface;
}
+QAbstractEventDispatcher *QVFbIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
QPlatformWindow *QVNCIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const
{
};
class QVNCIntegrationPrivate;
-
+class QAbstractEventDispatcher;
class QVNCIntegration : public QPlatformIntegration
{
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;
TARGET = qvncgraphicssystem
load(qt_plugin)
-QT += network
+QT += network core-private gui-private platformsupport-private
DESTDIR = $$QT.gui.plugins/platforms
#include "qwaylandclipboard.h"
#include "QtPlatformSupport/private/qgenericunixfontdatabase_p.h"
+#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtGui/QWindowSystemInterface>
#include <QtGui/QPlatformCursor>
return new QWaylandShmBackingStore(window);
}
+QAbstractEventDispatcher *QWaylandIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
QPlatformFontDatabase *QWaylandIntegration::fontDatabase() const
{
return mFontDb;
class QWaylandBuffer;
class QWaylandDisplay;
+class QAbstractEventDispatcher;
class QWaylandIntegration : public QPlatformIntegration
{
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;
include ($$PWD/gl_integration/gl_integration.pri)
include ($$PWD/windowmanager_integration/windowmanager_integration.pri)
+load(qpa/eventdispatchers/eventdispatchers)
#include <private/qpixmap_raster_p.h>
+#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <stdio.h>
return new QXcbBackingStore(window);
}
+QAbstractEventDispatcher *QXcbIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
+
QList<QPlatformScreen *> QXcbIntegration::screens() const
{
return m_screens;
QT_BEGIN_NAMESPACE
class QXcbConnection;
+class QAbstractEventDispatcher;
class QXcbIntegration : public QPlatformIntegration
{
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);
#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"
return new QXlibWindow(widget);
}
-
+QAbstractEventDispatcher *QXlibIntegration::createEventDispatcher() const
+{
+ return createUnixEventDispatcher();
+}
QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const
{
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;
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 \
#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