Make CoreFoundation event dispatcher available on OS X also

CoreFoundation event dispatcher on OS X can help users working with
QtBluetooth from either non-GUI threads or non-GUI applications.

Change-Id: Ie0793e7f49074a8ea9059251cd7c9bdf7953c206
Task-number: QTBUG-48758
Task-number: QTBUG-46625
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
bb10
Timur Pocheptsov 2015-11-13 14:14:11 +01:00
parent 10d311d9d2
commit d29fbbd6eb
2 changed files with 14 additions and 9 deletions

View File

@ -101,7 +101,8 @@ winrt {
mac {
HEADERS += \
kernel/qcfsocketnotifier_p.h \
kernel/qcore_mac_p.h
kernel/qcore_mac_p.h \
kernel/qeventdispatcher_cf_p.h
SOURCES += \
kernel/qcfsocketnotifier.cpp \
@ -109,18 +110,14 @@ mac {
kernel/qcore_mac.cpp
OBJECTIVE_SOURCES += \
kernel/qcore_mac_objc.mm
kernel/qcore_mac_objc.mm \
kernel/qeventdispatcher_cf.mm
LIBS_PRIVATE += -framework Foundation
osx: LIBS_PRIVATE += -framework CoreServices
osx: LIBS_PRIVATE += -framework CoreServices -framework AppKit
ios {
OBJECTIVE_SOURCES += \
kernel/qeventdispatcher_cf.mm
HEADERS += \
kernel/qeventdispatcher_cf_p.h
# We need UIKit for UIDevice
LIBS_PRIVATE += -framework UIKit
}

View File

@ -43,7 +43,11 @@
#include <limits>
#include <UIKit/UIApplication.h>
#ifdef Q_OS_OSX
# include <AppKit/NSApplication.h>
#else
# include <UIKit/UIApplication.h>
#endif
@interface RunLoopModeTracker : NSObject {
QStack<CFStringRef> m_runLoopModes;
@ -61,7 +65,11 @@
addObserver:self
selector:@selector(receivedNotification:)
name:nil
#ifdef Q_OS_OSX
object:[NSApplication sharedApplication]];
#else
object:[UIApplication sharedApplication]];
#endif
}
return self;