For some reason, GLFW's callback for a joystick connecting or disconnecting is not associated with a specific Window. This means it's not tied to a particular GL.Context either.
The problem is, we'd really like it to act no differently than the other callbacks, exposed through GL.Context.
So, we need a true (not thread-local) singleton which hooks into GLFW the first time it's initialized (or how about on __init__).
The hard part is how to provide the callback on each context's task. It will involve multithreading work. I think the most feasible option is to enqueue the events into each context using a read/write lock, then have the context check the queue whenever it gets a chance, such as during GL.set_render_state_field!().
For some reason, GLFW's callback for a joystick connecting or disconnecting is not associated with a specific Window. This means it's not tied to a particular
GL.Context
either.The problem is, we'd really like it to act no differently than the other callbacks, exposed through
GL.Context
.So, we need a true (not thread-local) singleton which hooks into GLFW the first time it's initialized (or how about on
__init__
).The hard part is how to provide the callback on each context's task. It will involve multithreading work. I think the most feasible option is to enqueue the events into each context using a read/write lock, then have the context check the queue whenever it gets a chance, such as during
GL.set_render_state_field!()
.