Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7808
Fixes #4499, #5387, #5170
"Making GLX context %p current to drawable %lu",
context, (unsigned long) drawable);
+ /* Work around a glitch, see
+ * https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5281
+ */
+ if (glXGetCurrentContext () != self->glx_context)
+ glXMakeContextCurrent (dpy, None, None, NULL);
+
if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context))
return FALSE;