x11: Move GL init code into the GL context

No functional changes, just shuffling code.
This commit is contained in:
Benjamin Otte 2021-06-12 11:07:24 +02:00
parent b1fbc2ef24
commit 0ddd06113d
3 changed files with 28 additions and 25 deletions

View File

@ -1335,25 +1335,6 @@ set_sm_client_id (GdkDisplay *display,
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_display_init_egl (self))
return;
}
if (gdk_x11_display_init_glx (self))
return;
}
/**
* gdk_x11_display_open:
* @display_name: (nullable): name of the X display.

View File

@ -102,3 +102,23 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
return FALSE;
}
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_display_init_egl (self))
return;
}
if (gdk_x11_display_init_glx (self))
return;
}

View File

@ -60,12 +60,14 @@ struct _GdkX11GLContextClass
void (* bind_for_frame_fence) (GdkX11GLContext *self);
};
GdkGLContext * gdk_x11_surface_create_gl_context (GdkSurface *window,
gboolean attached,
GdkGLContext *share,
GError **error);
gboolean gdk_x11_display_make_gl_context_current (GdkDisplay *display,
GdkGLContext *context);
void gdk_x11_display_init_gl (GdkX11Display *self);
GdkGLContext * gdk_x11_surface_create_gl_context (GdkSurface *window,
gboolean attached,
GdkGLContext *share,
GError **error);
gboolean gdk_x11_display_make_gl_context_current (GdkDisplay *display,
GdkGLContext *context);
/* GLX */
#define GDK_TYPE_X11_GL_CONTEXT_GLX (gdk_x11_gl_context_glx_get_type())