Fixes bug #2037, common EGL code for Android and X11