The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
993B

  1. #ifndef JUCE_LINUX_EVENTLOOP_H_INCLUDED
  2. #define JUCE_LINUX_EVENTLOOP_H_INCLUDED
  3. namespace LinuxEventLoop
  4. {
  5. struct CallbackFunctionBase
  6. {
  7. virtual ~CallbackFunctionBase() {}
  8. virtual bool operator()(int fd) = 0;
  9. bool active = true;
  10. };
  11. template <typename FdCallbackFunction>
  12. struct CallbackFunction : public CallbackFunctionBase
  13. {
  14. FdCallbackFunction callback;
  15. CallbackFunction (FdCallbackFunction c) : callback (c) {}
  16. bool operator() (int fd) override { return callback (fd); }
  17. };
  18. template <typename FdCallbackFunction>
  19. void setWindowSystemFd (int fd, FdCallbackFunction readCallback)
  20. {
  21. setWindowSystemFdInternal (fd, new CallbackFunction<FdCallbackFunction> (readCallback));
  22. }
  23. void removeWindowSystemFd() noexcept;
  24. void setWindowSystemFdInternal (int fd, CallbackFunctionBase* readCallback) noexcept;
  25. }
  26. #endif /* JUCE_LINUX_EVENTLOOP_H_INCLUDED */