1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-19 01:04:20 +00:00
JUCE/modules/juce_events/native/juce_linux_EventLoop.h
Felipe F. Tonello c2100022cc Added several linux improvements to the event loop, MIDI and X11 (see commit messsage)
MIDI: Several ALSA Seq improvements
===================================

Many things were done in this patch (I couldn't really split in several
patches):
 * Only one ALSA Sequencer client per application
 * ALSA Sequencer client name is the application's name by default
 * Fixed a bug when getDeivces() would return devices created by the
   application itself
 * Only ports created with createNewDevice() are allowed to be subscribed,
   other ports (created by openDevice()) doesn't allow subscription
 * AlsaPort is now handled by AlsaClient, basically having the proper
 representation such as the ALSA Sequencer has.

Files: Fix default directory paths
==================================

Some information on:
* Linux LSB FHS:
  http://www.linuxfoundation.org/collaborate/workgroups/lsb/fhs-30
* https://wiki.archlinux.org/index.php/Xdg_user_directories

Refactor Event loop to remove X11 dependency
============================================

The goal of this refactor was to remove X11 dependencies on juce_events
to enable non-gui applications (example, Embedded Linux apps) to have no
libx11 dependency.

The side-effect of this refactor is easy implementation of other Linux
graphical back-end, cleanup some code, better handling of X displays and
other benefits.

I removed a lot of the code from juce_linux_Windowing to separate files
for clarity. I also renamed all Linux X11 files to *linux_X11* instead of
just *linux*.

X11: Remove unnecessary XGrabButton call
========================================

This call is made unnecessary if used proper window flags when a window
is created.
2017-02-13 17:14:34 +00:00

33 lines
993 B
C++

#ifndef JUCE_LINUX_EVENTLOOP_H_INCLUDED
#define JUCE_LINUX_EVENTLOOP_H_INCLUDED
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;
}
#endif /* JUCE_LINUX_EVENTLOOP_H_INCLUDED */