Libraries like Qt provide an event loop that handles UI events, often (or always?) wrapping the OS UI event loop in order to achieve the best results.
Now I can't help wondering if there is a way to write the UI without that master event loop, such that it works on all major OSes.
If this is possible, how would it work, and are there any examples in the wild of an event-loop free UI (preferably in C++)?
Windows and X11 (Linux) both require that any windows be answerable to Event Callbacks (or be the parent of a window currently answering event callbacks), or else the OS will treat them as though they stopped responding—and on Windows at least, will trigger a "Program X has stopped responding" pop-up.
The semantics of how those event callbacks need to be handled is different (namely, Windows requires the "Thread that created the window" to handle them, whereas Linux requires the "Main Thread" to handle them) but the principle is the same.
I'm not familiar with MacOS, but I'd presume it has similar logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With