X11 security - preventing global keylogging

Wayland advocates often complain about “security” in x11. One of the complaints is how you can have a keylogger without sudo privileges (for example xinput can do this). This video shows xkbcat, a keylogger for x11 being restricted to windows it owns only, preventing keylogging. Bottom right is xkbcat running in a terminal and top right is a window it owns. As you can see, it can only see keys that were input to a window it owns.

Accessing X11 window texture without copying

X11 has an extension called XComposite, which are often used by compositors, but these features can also be used in regular programs for getting direct access to the opengl texture associated with an X11 window. This is done using the XCompositeRedirectWindow, XCompositeNameWindowPixmap, glXCreatePixmap and glXBindTexImageEXT functions. See window-texture for a code example or for simple functions to use in your program. I’ve used this feature to make the fastest fully GPU accelerated screen (window) recorder on linux.