[gtk/ebassi/egl-display-get: 1/2] x11: Add EGLDisplay getter
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/egl-display-get: 1/2] x11: Add EGLDisplay getter
- Date: Tue, 11 May 2021 11:42:23 +0000 (UTC)
commit abc2d7e4a905817556b5eb86970255b92e1ad218
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue May 11 12:25:38 2021 +0100
x11: Add EGLDisplay getter
Getting an EGLDisplay object is messy; might as well expose the function
we use internally to save some time.
gdk/x11/gdkglcontext-egl.c | 19 ++++++++++++++++++-
gdk/x11/gdkx11glcontext.h | 3 +++
2 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/gdk/x11/gdkglcontext-egl.c b/gdk/x11/gdkglcontext-egl.c
index 1836f19057..91f3e8297c 100644
--- a/gdk/x11/gdkglcontext-egl.c
+++ b/gdk/x11/gdkglcontext-egl.c
@@ -84,12 +84,29 @@ drawable_info_free (gpointer data)
g_free (info);
}
-static EGLDisplay
+/**
+ * gdk_x11_display_get_egl_display:
+ * @display: (type GdkX11Display): an X11 display
+ *
+ * Retrieves the EGL display connection object for the given GDK display.
+ *
+ * This function returns `NULL` if GDK is using GLX.
+ *
+ * Returns: (nullable): the EGL display object
+ *
+ * Since: 4.4
+ */
+gpointer
gdk_x11_display_get_egl_display (GdkDisplay *display)
{
EGLDisplay edpy = NULL;
Display *dpy;
+ g_return_val_if_fail (GDK_IS_X11_DISPLAY (display), NULL);
+
+ if (GDK_X11_DISPLAY (display)->have_glx)
+ return NULL;
+
edpy = g_object_get_data (G_OBJECT (display), "-gdk-x11-egl-display");
if (edpy != NULL)
return edpy;
diff --git a/gdk/x11/gdkx11glcontext.h b/gdk/x11/gdkx11glcontext.h
index 34cbd70d75..173f6acac7 100644
--- a/gdk/x11/gdkx11glcontext.h
+++ b/gdk/x11/gdkx11glcontext.h
@@ -48,6 +48,9 @@ gboolean gdk_x11_display_get_egl_version (GdkDisplay *display,
int *major,
int *minor);
+GDK_AVAILABLE_IN_4_4
+gpointer gdk_x11_display_get_egl_display (GdkDisplay *display);
+
G_END_DECLS
#endif /* __GDK_X11_GL_CONTEXT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]