Sometimes, GLX can decide to use the previous request serial when faking
XErrors via __glXSendError() (look through the Mesa sources to enjoy).
This can cause the error trap we just installed to not feel responsible
for the error. And that makes GDK decide to immediately abort the
application.
That is not what we or GLX want.
So we use a no-op X Request to bump the request number so that when GLX
does its shenanigans, it uses a serial that our error trap will catch.
Fixes a crash in mutter's CI which apparently manages to drive GLX
without an X server.
gdk_x11_display_error_trap_push (display);
+ /* Increase XNextRequest because GLX may fake errors with the last request
+ * and we want the error trap to catch them */
+ XChangeWindowAttributes (GDK_DISPLAY_XDISPLAY (display),
+ GDK_X11_DISPLAY (display)->leader_window,
+ 0,
+ (XSetWindowAttributes[1]) { 0, });
+
if (preferred_api == GDK_GL_API_GL)
{
api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy);