Fixes #2326, clean up the X11 backend a bit