[gtk/wip/otte/gleanup: 118/121] x11: Move GL init code into the GL context




commit 6670ba28643caa45cb9d11c052bb378f9f7e655c
Author: Benjamin Otte <otte redhat com>
Date:   Sat Jun 12 11:07:24 2021 +0200

    x11: Move GL init code into the GL context
    
    No functional changes, just shuffling code.

 gdk/x11/gdkdisplay-x11.c   | 19 -------------------
 gdk/x11/gdkglcontext-x11.c | 20 ++++++++++++++++++++
 gdk/x11/gdkglcontext-x11.h | 14 ++++++++------
 3 files changed, 28 insertions(+), 25 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index d1a15402bd..de0a014146 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1339,25 +1339,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.
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index e22f1a26ff..58a6c11ca4 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -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;
+}
+
diff --git a/gdk/x11/gdkglcontext-x11.h b/gdk/x11/gdkglcontext-x11.h
index ca296a2c97..78377afc49 100644
--- a/gdk/x11/gdkglcontext-x11.h
+++ b/gdk/x11/gdkglcontext-x11.h
@@ -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())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]