mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-26 02:14:22 +00:00
30 lines
877 B
C++
30 lines
877 B
C++
#pragma once
|
|
|
|
namespace LinuxEventLoop
|
|
{
|
|
struct CallbackFunctionBase
|
|
{
|
|
virtual ~CallbackFunctionBase() {}
|
|
virtual bool operator()(int fd) = 0;
|
|
bool active = true;
|
|
};
|
|
|
|
template <typename FdCallbackFunction>
|
|
struct CallbackFunction : public CallbackFunctionBase
|
|
{
|
|
FdCallbackFunction callback;
|
|
|
|
CallbackFunction (FdCallbackFunction c) : callback (c) {}
|
|
|
|
bool operator() (int fd) override { return callback (fd); }
|
|
};
|
|
|
|
template <typename FdCallbackFunction>
|
|
void setWindowSystemFd (int fd, FdCallbackFunction readCallback)
|
|
{
|
|
setWindowSystemFdInternal (fd, new CallbackFunction<FdCallbackFunction> (readCallback));
|
|
}
|
|
void removeWindowSystemFd() noexcept;
|
|
|
|
void setWindowSystemFdInternal (int fd, CallbackFunctionBase* readCallback) noexcept;
|
|
}
|