Why callbacks instead of lower level event queue

This question may have been asked before since there is even a library dedicated to generating an event queue from glfw callbacks, called gleq. But I couldn’t find any discussions on this subjects outside of the github page.

I have worked in X11, where an event queue is used to handle events. I would iterate the queue and for each event call the relevant callback function.

glfw doesn’t seem to allow to work with the event queue directly. And instead offers callbacks. I’m wondering if this is done because it was deemed easier to grasp the callbacks for the average user than an event queue? Or has it rather do with how other operating systems like Windows and MacOS handle the events, and not allowing to work with the event queue directly?

1 Like