gdk_x11_get_xatom_by_name_for_display (display, "SM_CLIENT_ID"));
}
+static void
+gdk_x11_display_init_gl (GdkX11Display *self)
+{
+ GdkDisplay *display G_GNUC_UNUSED = GDK_DISPLAY (self);
+
+ if (GDK_DISPLAY_DEBUG_CHECK (display, GL_DISABLE))
+ return;
+
+ if (!GDK_DISPLAY_DEBUG_CHECK (display, GL_GLX))
+ {
+ /* We favour EGL */
+ if (gdk_x11_screen_init_egl (self->screen))
+ return;
+ }
+
+ if (gdk_x11_screen_init_glx (self->screen))
+ return;
+}
+
/**
* gdk_x11_display_open:
* @display_name: (nullable): name of the X display.
* as we care about GLX details such as alpha/depth/stencil depth,
* stereo and double buffering
*/
+ gdk_x11_display_init_gl (display_x11);
gdk_x11_screen_update_visuals_for_glx (display_x11->screen);
if (display_x11->screen->rgba_visual)
self->do_frame_sync = TRUE;
}
-gboolean
-gdk_x11_screen_init_gl (GdkX11Screen *screen)
-{
- GdkDisplay *display G_GNUC_UNUSED = GDK_SCREEN_DISPLAY (screen);
-
- if (GDK_DISPLAY_DEBUG_CHECK (display, GL_DISABLE))
- return FALSE;
-
- if (!GDK_DISPLAY_DEBUG_CHECK (display, GL_GLX))
- {
- /* We favour EGL */
- if (gdk_x11_screen_init_egl (screen))
- return TRUE;
- }
-
- if (gdk_x11_screen_init_glx (screen))
- return TRUE;
-
- return FALSE;
-}
-
GdkGLContext *
gdk_x11_surface_create_gl_context (GdkSurface *surface,
gboolean attached,
GdkDisplay *display;
display = gdk_surface_get_display (surface);
+ display_x11 = GDK_X11_DISPLAY (display);
- if (!gdk_x11_screen_init_gl (GDK_SURFACE_SCREEN (surface)))
+ if (display_x11->have_egl)
+ context = gdk_x11_gl_context_egl_new (surface, attached, share, error);
+ else if (display_x11->have_glx)
+ context = gdk_x11_gl_context_glx_new (surface, attached, share, error);
+ else
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
return NULL;
}
- display_x11 = GDK_X11_DISPLAY (display);
- if (display_x11->have_egl)
- context = gdk_x11_gl_context_egl_new (surface, attached, share, error);
- else if (display_x11->have_glx)
- context = gdk_x11_gl_context_glx_new (surface, attached, share, error);
- else
- g_assert_not_reached ();
-
if (context == NULL)
return NULL;