CF Events?


#1

Does Juce in anyway block CFEvents? It’s using Carbon, right, so I should in theory be able to GetCurrentEventLoop() then from there I should be able to CFRunLoopAddSource. Anything I’m not aware of?


#2

It doesn’t block any events, so I guess that should work. I’m no expert on run loops, but shout if you have a problem.


#3

ok, well I’m trying to do the equivalent of the “Another USB Notification Example” in /Developer/Examples/IOKit/USB/ and for some reason I can get what I assume is valid data in the ports, and then IOServiceAddMatchingNotification, but my call back is never being triggered once the app enters into it’s work loop. I wasn’t sure if there was any filtering going on. Any thoughts?


#4

Can’t think of anything right now.

You can see the event dispatch stuff in juce_mac_Messaging.cpp, the main function being juce_dispatchNextMessageOnSystemQueue(). It just sends out whatever events arrive - nothing fancy going on there…


#5

Hrmm, ok, so instead of using RunApplicationEventLoop() you’re looping through ReceiveNextEvent(). Now the example I followed had me GetCFRunLoopFromEventLoop(GetMainEventLoop()) for CFRunLoopAddSource(). I wonder if I’m not adding this to the right source? Just more thinking out loud here, but if anyone has an idea, chime in.


#6

Just to update things, nothing in Juce was blocking a CFLoop. I had some other issues. Wanted to clarify in case someone else went looking for the same. I did create a new thread to run a CFRunLoop on for USB insert/removal notification. Works good!


#7

cool, glad you got it working.


#8