GTK+: GL: Trap X11 errors on context creation.

This commit is contained in:
Brandon Wright 2019-02-07 15:05:09 -06:00
parent 19f03c44de
commit dd4614dada
2 changed files with 15 additions and 1 deletions

View File

@ -30,6 +30,18 @@
#define GDK_IS_X11_DISPLAY(display) true
#define gdk_x11_window_get_xid(window) GDK_WINDOW_XWINDOW (window)
inline void gdk_x11_display_error_trap_push(GdkDisplay *dpy)
{
gdk_error_trap_push();
}
inline void gdk_x11_display_error_trap_pop_ignored(GdkDisplay *dpy)
{
if (gdk_error_trap_pop())
{
}
}
inline void gdk_window_get_geometry (GdkWindow *window,
gint *x,
gint *y,

View File

@ -75,7 +75,7 @@ bool GTKGLXContext::attach (GtkWidget *widget)
return false;
}
fbconfig = fbconfigs[0];
XFree (fbconfigs);
XFree(fbconfigs);
vi = glXGetVisualFromFBConfig (display, fbconfig);
@ -107,10 +107,12 @@ bool GTKGLXContext::create_context ()
const char *extensions = glXQueryExtensionsString (display, screen);
gdk_x11_display_error_trap_push(gdk_display);
if (strstr (extensions, "GLX_ARB_create_context"))
context = glXCreateContextAttribsARB (display, fbconfig, NULL, True, context_attribs);
if (!context)
context = glXCreateNewContext (display, fbconfig, GLX_RGBA_TYPE, NULL, True);
gdk_x11_display_error_trap_pop_ignored(gdk_display);
if (!context)
{