diff options
Diffstat (limited to 'Swiften/EventLoop')
-rw-r--r-- | Swiften/EventLoop/Cocoa/CocoaEvent.h | 9 | ||||
-rw-r--r-- | Swiften/EventLoop/Cocoa/CocoaEvent.mm | 2 | ||||
-rw-r--r-- | Swiften/EventLoop/EventLoop.cpp | 9 | ||||
-rw-r--r-- | Swiften/EventLoop/EventLoop.h | 5 | ||||
-rw-r--r-- | Swiften/EventLoop/SConscript | 2 | ||||
-rw-r--r-- | Swiften/EventLoop/SimpleEventLoop.cpp | 2 |
6 files changed, 16 insertions, 13 deletions
diff --git a/Swiften/EventLoop/Cocoa/CocoaEvent.h b/Swiften/EventLoop/Cocoa/CocoaEvent.h index bede7ff..89d056f 100644 --- a/Swiften/EventLoop/Cocoa/CocoaEvent.h +++ b/Swiften/EventLoop/Cocoa/CocoaEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -13,11 +13,18 @@ namespace Swift { class CocoaEventLoop; } +// Using deprecated declaration of instance vars in interface, because this +// is required for older runtimes (e.g. 32-bit Mac OS X) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-interface-ivars" + @interface CocoaEvent : NSObject { Swift::Event* event; Swift::CocoaEventLoop* eventLoop; } +#pragma clang diagnostic pop + // Takes ownership of event - (id) initWithEvent: (Swift::Event*) e eventLoop: (Swift::CocoaEventLoop*) el; - (void) process; diff --git a/Swiften/EventLoop/Cocoa/CocoaEvent.mm b/Swiften/EventLoop/Cocoa/CocoaEvent.mm index 049e3b6..7b1b4b0 100644 --- a/Swiften/EventLoop/Cocoa/CocoaEvent.mm +++ b/Swiften/EventLoop/Cocoa/CocoaEvent.mm @@ -2,7 +2,7 @@ #include <Swiften/EventLoop/Event.h> #include <Swiften/EventLoop/Cocoa/CocoaEventLoop.h> -@implementation CocoaEvent +@implementation CocoaEvent - (id) initWithEvent: (Swift::Event*) e eventLoop: (Swift::CocoaEventLoop*) el { self = [super init]; diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp index cd4e461..502bc49 100644 --- a/Swiften/EventLoop/EventLoop.cpp +++ b/Swiften/EventLoop/EventLoop.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ @@ -7,13 +7,16 @@ #include <Swiften/EventLoop/EventLoop.h> #include <algorithm> -#include <boost/bind.hpp> #include <iostream> #include <cassert> +#include <boost/bind.hpp> +#include <boost/lambda/lambda.hpp> +#include <boost/lambda/bind.hpp> #include <boost/thread/locks.hpp> #include <Swiften/Base/Log.h> +namespace lambda = boost::lambda; namespace Swift { @@ -84,7 +87,7 @@ void EventLoop::postEvent(boost::function<void ()> callback, boost::shared_ptr<E void EventLoop::removeEventsFromOwner(boost::shared_ptr<EventOwner> owner) { boost::lock_guard<boost::mutex> lock(eventsMutex_); - events_.remove_if(HasOwner(owner)); + events_.remove_if(lambda::bind(&Event::owner, lambda::_1) == owner); } } diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h index 4a602ae..587ba22 100644 --- a/Swiften/EventLoop/EventLoop.h +++ b/Swiften/EventLoop/EventLoop.h @@ -35,11 +35,6 @@ namespace Swift { void handleEvent(const Event& event); private: - struct HasOwner { - HasOwner(boost::shared_ptr<EventOwner> owner) : owner(owner) {} - bool operator()(const Event& event) const { return event.owner == owner; } - boost::shared_ptr<EventOwner> owner; - }; boost::mutex eventsMutex_; unsigned int nextEventID_; std::list<Event> events_; diff --git a/Swiften/EventLoop/SConscript b/Swiften/EventLoop/SConscript index b405f6b..8bef8fb 100644 --- a/Swiften/EventLoop/SConscript +++ b/Swiften/EventLoop/SConscript @@ -12,7 +12,7 @@ sources = [ objects = swiften_env.SwiftenObject(sources) swiften_env.Append(SWIFTEN_OBJECTS = [objects]) -if swiften_env["PLATFORM"] == "darwin" : +if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native": myenv = swiften_env.Clone() myenv.Append(CXXFLAGS = myenv["OBJCCFLAGS"]) objects = myenv.SwiftenObject([ diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp index 63b8ba5..42a5481 100644 --- a/Swiften/EventLoop/SimpleEventLoop.cpp +++ b/Swiften/EventLoop/SimpleEventLoop.cpp @@ -14,8 +14,6 @@ namespace Swift { -void nop() {} - SimpleEventLoop::SimpleEventLoop() : isRunning_(true) { } |