Fix compilation with libX11 >= 1.5.99.902.

These changes fixes bug #1769 for SDL2
(http://bugzilla.libsdl.org/show_bug.cgi?id=1769).