Move QEventDispatcherCoreFoundation to QtCore

Export it for use by the iOS platform plugin. Also
move QCFSocketNotifier, and export for use by the
Cocoa platform plugin.

This is a pure code move with no intended behavior
changes, in anticipation of using the Core Foundation
event dispatcher as the default Qt Core event dispatcher
on OS X.

Change-Id: I43677d2f6f3c1d0ed0415c964225aa97d2f13078
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Morten Johan Sørvig 2015-06-30 13:28:31 +02:00 committed by Tor Arne Vestbø
parent 40b4c305d8
commit c751cef8d6
10 changed files with 23 additions and 27 deletions

View File

@ -100,9 +100,11 @@ winrt {
mac { mac {
HEADERS += \ HEADERS += \
kernel/qcfsocketnotifier_p.h \
kernel/qcore_mac_p.h kernel/qcore_mac_p.h
SOURCES += \ SOURCES += \
kernel/qcfsocketnotifier.cpp \
kernel/qcoreapplication_mac.cpp \ kernel/qcoreapplication_mac.cpp \
kernel/qcore_mac.cpp kernel/qcore_mac.cpp
@ -113,8 +115,15 @@ mac {
osx: LIBS_PRIVATE += -framework CoreServices osx: LIBS_PRIVATE += -framework CoreServices
# We need UIKit for UIDevice ios {
ios: LIBS_PRIVATE += -framework UIKit OBJECTIVE_SOURCES += \
kernel/qeventdispatcher_cf.mm
HEADERS += \
kernel/qeventdispatcher_cf_p.h
# We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit
}
} }
nacl { nacl {

View File

@ -3,7 +3,7 @@
** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the QtGui module of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL21$ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage ** Commercial License Usage
@ -32,7 +32,7 @@
****************************************************************************/ ****************************************************************************/
#include "qcfsocketnotifier_p.h" #include "qcfsocketnotifier_p.h"
#include <QtGui/qguiapplication.h> #include <QtCore/qcoreapplication.h>
#include <QtCore/qsocketnotifier.h> #include <QtCore/qsocketnotifier.h>
#include <QtCore/qthread.h> #include <QtCore/qthread.h>
@ -57,12 +57,12 @@ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CF
if (callbackType == kCFSocketReadCallBack) { if (callbackType == kCFSocketReadCallBack) {
if (socketInfo->readNotifier && socketInfo->readEnabled) { if (socketInfo->readNotifier && socketInfo->readEnabled) {
socketInfo->readEnabled = false; socketInfo->readEnabled = false;
QGuiApplication::sendEvent(socketInfo->readNotifier, &notifierEvent); QCoreApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
} }
} else if (callbackType == kCFSocketWriteCallBack) { } else if (callbackType == kCFSocketWriteCallBack) {
if (socketInfo->writeNotifier && socketInfo->writeEnabled) { if (socketInfo->writeNotifier && socketInfo->writeEnabled) {
socketInfo->writeEnabled = false; socketInfo->writeEnabled = false;
QGuiApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent); QCoreApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent);
} }
} }

View File

@ -3,7 +3,7 @@
** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the QtGui module of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL21$ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage ** Commercial License Usage
@ -75,7 +75,7 @@ typedef void (*MaybeCancelWaitForMoreEventsFn)(QAbstractEventDispatcher *hostEve
// setHostEventDispatcher() should be called at startup. // setHostEventDispatcher() should be called at startup.
// removeSocketNotifiers() should be called at shutdown. // removeSocketNotifiers() should be called at shutdown.
// //
class QCFSocketNotifier class Q_CORE_EXPORT QCFSocketNotifier
{ {
public: public:
QCFSocketNotifier(); QCFSocketNotifier();

View File

@ -3,7 +3,7 @@
** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the plugins of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL21$ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage ** Commercial License Usage

View File

@ -3,7 +3,7 @@
** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/ ** Contact: http://www.qt.io/licensing/
** **
** This file is part of the plugins of the Qt Toolkit. ** This file is part of the QtCore module of the Qt Toolkit.
** **
** $QT_BEGIN_LICENSE:LGPL21$ ** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage ** Commercial License Usage
@ -83,8 +83,8 @@
#include <QtCore/qabstracteventdispatcher.h> #include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/private/qtimerinfo_unix_p.h> #include <QtCore/private/qtimerinfo_unix_p.h>
#include <QtCore/private/qcfsocketnotifier_p.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtPlatformSupport/private/qcfsocketnotifier_p.h>
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#ifdef __OBJC__ #ifdef __OBJC__
@ -196,7 +196,7 @@ private:
CFRunLoopObserverRef m_observer; CFRunLoopObserverRef m_observer;
}; };
class QEventDispatcherCoreFoundation : public QAbstractEventDispatcher class Q_CORE_EXPORT QEventDispatcherCoreFoundation : public QAbstractEventDispatcher
{ {
Q_OBJECT Q_OBJECT

View File

@ -1,4 +0,0 @@
mac {
HEADERS += $$PWD/qcfsocketnotifier_p.h
SOURCES += $$PWD/qcfsocketnotifier.cpp
}

View File

@ -8,14 +8,6 @@ HEADERS +=\
$$PWD/qgenericunixeventdispatcher_p.h\ $$PWD/qgenericunixeventdispatcher_p.h\
} }
ios {
OBJECTIVE_SOURCES +=\
$$PWD/qeventdispatcher_cf.mm
HEADERS +=\
$$PWD/qeventdispatcher_cf_p.h
}
contains(QT_CONFIG, glib) { contains(QT_CONFIG, glib) {
SOURCES +=$$PWD/qeventdispatcher_glib.cpp SOURCES +=$$PWD/qeventdispatcher_glib.cpp
HEADERS +=$$PWD/qeventdispatcher_glib_p.h HEADERS +=$$PWD/qeventdispatcher_glib_p.h

View File

@ -7,7 +7,6 @@ mac:LIBS_PRIVATE += -lz
DEFINES += QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
include(cfsocketnotifier/cfsocketnotifier.pri)
include(cglconvenience/cglconvenience.pri) include(cglconvenience/cglconvenience.pri)
include(eglconvenience/eglconvenience.pri) include(eglconvenience/eglconvenience.pri)
include(eventdispatchers/eventdispatchers.pri) include(eventdispatchers/eventdispatchers.pri)

View File

@ -83,8 +83,8 @@
#include <QtCore/qstack.h> #include <QtCore/qstack.h>
#include <QtGui/qwindowdefs.h> #include <QtGui/qwindowdefs.h>
#include <QtCore/private/qabstracteventdispatcher_p.h> #include <QtCore/private/qabstracteventdispatcher_p.h>
#include <QtCore/private/qcfsocketnotifier_p.h>
#include <QtCore/private/qtimerinfo_unix_p.h> #include <QtCore/private/qtimerinfo_unix_p.h>
#include <QtPlatformSupport/private/qcfsocketnotifier_p.h>
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>

View File

@ -34,7 +34,7 @@
#ifndef QIOSEVENTDISPATCHER_H #ifndef QIOSEVENTDISPATCHER_H
#define QIOSEVENTDISPATCHER_H #define QIOSEVENTDISPATCHER_H
#include <QtPlatformSupport/private/qeventdispatcher_cf_p.h> #include <QtCore/private/qeventdispatcher_cf_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE