[gtk/wip/otte/gleanup: 12/12] x11: Move the EGL display into the private struct
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/gleanup: 12/12] x11: Move the EGL display into the private struct
- Date: Mon, 7 Jun 2021 12:57:59 +0000 (UTC)
commit 34b8eef4016549745068f1dc4290486f6d351253
Author: Benjamin Otte <otte redhat com>
Date: Mon Jun 7 14:30:29 2021 +0200
x11: Move the EGL display into the private struct
There's no need to use g_object_set_data() for it.
gdk/x11/gdkdisplay-x11.h | 1 +
gdk/x11/gdkglcontext-egl.c | 29 ++++++++++++-----------------
2 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.h b/gdk/x11/gdkdisplay-x11.h
index db48411091..cb90df00b3 100644
--- a/gdk/x11/gdkdisplay-x11.h
+++ b/gdk/x11/gdkdisplay-x11.h
@@ -137,6 +137,7 @@ struct _GdkX11Display
int glx_event_base;
/* EGL information */
+ gpointer egl_display;
int egl_version;
/* Translation between X server time and system-local monotonic time */
diff --git a/gdk/x11/gdkglcontext-egl.c b/gdk/x11/gdkglcontext-egl.c
index 8d4dff9483..8bce4fc0e0 100644
--- a/gdk/x11/gdkglcontext-egl.c
+++ b/gdk/x11/gdkglcontext-egl.c
@@ -99,17 +99,16 @@ drawable_info_free (gpointer data)
gpointer
gdk_x11_display_get_egl_display (GdkDisplay *display)
{
- EGLDisplay edpy = NULL;
+ GdkX11Display *self = GDK_X11_DISPLAY (display);
Display *dpy;
g_return_val_if_fail (GDK_IS_X11_DISPLAY (display), NULL);
- if (GDK_X11_DISPLAY (display)->have_glx)
+ if (!self->have_egl)
return NULL;
- edpy = g_object_get_data (G_OBJECT (display), "-gdk-x11-egl-display");
- if (edpy != NULL)
- return edpy;
+ if (self->egl_display)
+ return self->egl_display;
dpy = gdk_x11_display_get_xdisplay (display);
@@ -119,10 +118,10 @@ gdk_x11_display_get_egl_display (GdkDisplay *display)
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
if (getPlatformDisplay != NULL)
- edpy = getPlatformDisplay (EGL_PLATFORM_X11_KHR, dpy, NULL);
+ self->egl_display = getPlatformDisplay (EGL_PLATFORM_X11_KHR, dpy, NULL);
- if (edpy != NULL)
- goto out;
+ if (self->egl_display != NULL)
+ return self->egl_display;
}
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
@@ -131,19 +130,15 @@ gdk_x11_display_get_egl_display (GdkDisplay *display)
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
if (getPlatformDisplay)
- edpy = getPlatformDisplay (EGL_PLATFORM_X11_EXT, dpy, NULL);
+ self->egl_display = getPlatformDisplay (EGL_PLATFORM_X11_EXT, dpy, NULL);
- if (edpy != NULL)
- goto out;
+ if (self->egl_display != NULL)
+ return self->egl_display;
}
- edpy = eglGetDisplay ((EGLNativeDisplayType) dpy);
+ self->egl_display = eglGetDisplay ((EGLNativeDisplayType) dpy);
-out:
- if (edpy != NULL)
- g_object_set_data (G_OBJECT (display), "-gdk-x11-egl-display", edpy);
-
- return edpy;
+ return self->egl_display;
}
static XVisualInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]