diff --git a/modules/juce_events/native/juce_linux_EventLoop.h b/modules/juce_events/native/juce_linux_EventLoop.h index cb7aded887..4aac0967de 100644 --- a/modules/juce_events/native/juce_linux_EventLoop.h +++ b/modules/juce_events/native/juce_linux_EventLoop.h @@ -34,8 +34,11 @@ namespace LinuxEventLoop @param fd the file descriptor to be monitored @param readCallback a callback that will be called when the file descriptor has data to read. The file descriptor will be passed as an argument + @param eventMask a bit mask specifying the events you are interested in for the + file descriptor. The possible values for this are defined in + */ - void registerFdCallback (int fd, std::function readCallback); + void registerFdCallback (int fd, std::function readCallback, short eventMask = 1 /*POLLIN*/); /** Unregisters a previously registered file descriptor. diff --git a/modules/juce_events/native/juce_linux_Messaging.cpp b/modules/juce_events/native/juce_linux_Messaging.cpp index 544ed7ad74..fb2c8266c7 100644 --- a/modules/juce_events/native/juce_linux_Messaging.cpp +++ b/modules/juce_events/native/juce_linux_Messaging.cpp @@ -119,12 +119,12 @@ public: fdReadCallbacks.reserve (8); } - void registerFdCallback (int fd, std::function&& cb) + void registerFdCallback (int fd, std::function&& cb, short eventMask) { const ScopedLock sl (lock); fdReadCallbacks.push_back ({ fd, std::move (cb) }); - pfds.push_back ({ fd, POLLIN, 0 }); + pfds.push_back ({ fd, eventMask, 0 }); } void unregisterFdCallback (int fd) @@ -273,10 +273,10 @@ bool MessageManager::dispatchNextMessageOnSystemQueue (bool returnIfNoPendingMes } //============================================================================== -void LinuxEventLoop::registerFdCallback (int fd, std::function readCallback) +void LinuxEventLoop::registerFdCallback (int fd, std::function readCallback, short eventMask) { if (auto* runLoop = InternalRunLoop::getInstanceWithoutCreating()) - runLoop->registerFdCallback (fd, std::move (readCallback)); + runLoop->registerFdCallback (fd, std::move (readCallback), eventMask); } void LinuxEventLoop::unregisterFdCallback (int fd)