Input handlingXiqual has an input loop readymade for your perusal. It might not be the best loop in the world, but it does save me some work when creating a new SDL application.
To make use of this, you must pass a main loop of your own which merely tests the arguments passed. Xiqual does all the dreary work of grabbing mouse, keyboard and joystick state.
The actual input arguments are documented in the xiglob structure (click the link below). They are just the usual ones you expect from an SDL application.
Any LUI gadgets added with lui_addgadget() will also be automatically handled in the same thread as xi_main(). That means highlighting, togglestate, calling activation hooks and whatnot.
Finally, the mouse cursor is handled via xi_main(). Its view is hidden while processing the mainloop, so there is no danger of overlapping anything that way.
Updates: The current system simply uses SDL_Flip() at the end of the loop. I'm not sure how fast this is in the average case, but profiling so far has been encouraging.
Overlapping gadgets: Gadgets are redrawn very rarely. If a gadget's alternate (clicked/highlighted) state has a very different shape and size from the regular state, there is no guarantee the gadget will update if you happen to overwrite some of it. The current gadgets redraw when switching state, but may try to be more "intelligent" in the future.
So if adding LUI to an application, it's best to keep the gui on its own side of the screen, or even draw it to a view. The ability to make any SDL surface a gadget's main output is part of the reason why no updates are happening via SDL_UpdateRect(). At least I can brag about how object-oriented this interface is.