[gtk/wip/otte/gleanup: 35/73] x11: Pass the display, not the screen




commit f23c8130b659a65bb0e79541f2ef95f34c74438d
Author: Benjamin Otte <otte redhat com>
Date:   Sun Jun 6 19:56:35 2021 +0200

    x11: Pass the display, not the screen
    
    Screens are on their way out.

 gdk/x11/gdkdisplay-x11.c   |  4 ++--
 gdk/x11/gdkglcontext-egl.c |  8 ++------
 gdk/x11/gdkglcontext-glx.c | 16 ++++++----------
 gdk/x11/gdkglcontext-x11.h |  7 ++++---
 4 files changed, 14 insertions(+), 21 deletions(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 156872a362..d1a15402bd 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1350,11 +1350,11 @@ gdk_x11_display_init_gl (GdkX11Display *self)
   if (!GDK_DISPLAY_DEBUG_CHECK (display, GL_GLX))
     {
       /* We favour EGL */
-      if (gdk_x11_screen_init_egl (self->screen))
+      if (gdk_x11_display_init_egl (self))
         return;
     }
 
-  if (gdk_x11_screen_init_glx (self->screen))
+  if (gdk_x11_display_init_glx (self))
     return;
 }
 
diff --git a/gdk/x11/gdkglcontext-egl.c b/gdk/x11/gdkglcontext-egl.c
index c59812bc1f..8d4dff9483 100644
--- a/gdk/x11/gdkglcontext-egl.c
+++ b/gdk/x11/gdkglcontext-egl.c
@@ -566,17 +566,13 @@ gdk_x11_gl_context_egl_init (GdkX11GLContextEGL *self)
 }
 
 gboolean
-gdk_x11_screen_init_egl (GdkX11Screen *screen)
+gdk_x11_display_init_egl (GdkX11Display *display_x11)
 {
-  GdkDisplay *display = GDK_SCREEN_DISPLAY (screen);
-  GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
+  GdkDisplay *display = GDK_DISPLAY (display_x11);
   EGLDisplay edpy;
   Display *dpy;
   int major, minor;
 
-  if (display_x11->have_egl)
-    return TRUE;
-
   dpy = gdk_x11_display_get_xdisplay (display);
 
   if (!epoxy_has_egl ())
diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c
index bc6d66a7e5..3bdfe431ea 100644
--- a/gdk/x11/gdkglcontext-glx.c
+++ b/gdk/x11/gdkglcontext-glx.c
@@ -1200,27 +1200,23 @@ gdk_x11_display_get_glx_version (GdkDisplay *display,
 }
 
 /*< private >
- * gdk_x11_screen_init_glx:
- * @screen: an X11 screen
+ * gdk_x11_display_init_glx:
+ * @display_x11: an X11 display that has not been inited yet. 
  *
  * Initializes the cached GLX state for the given @screen.
  *
- * It's safe to call this function multiple times.
+ * This function must be called exactly once during initialization.
  *
  * Returns: %TRUE if GLX was initialized
  */
 gboolean
-gdk_x11_screen_init_glx (GdkX11Screen *screen)
+gdk_x11_display_init_glx (GdkX11Display *display_x11)
 {
-  GdkDisplay *display = GDK_SCREEN_DISPLAY (screen);
-  GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
+  GdkDisplay *display = GDK_DISPLAY (display_x11);
   Display *dpy;
   int error_base, event_base;
   int screen_num;
 
-  if (display_x11->have_glx)
-    return TRUE;
-
   dpy = gdk_x11_display_get_xdisplay (display);
 
   if (!epoxy_has_glx (dpy))
@@ -1229,7 +1225,7 @@ gdk_x11_screen_init_glx (GdkX11Screen *screen)
   if (!glXQueryExtension (dpy, &error_base, &event_base))
     return FALSE;
 
-  screen_num = screen->screen_num;
+  screen_num = display_x11->screen->screen_num;
 
   display_x11->have_glx = TRUE;
 
diff --git a/gdk/x11/gdkglcontext-x11.h b/gdk/x11/gdkglcontext-x11.h
index eaba65df2a..97583133f2 100644
--- a/gdk/x11/gdkglcontext-x11.h
+++ b/gdk/x11/gdkglcontext-x11.h
@@ -34,7 +34,7 @@
 #include <epoxy/glx.h>
 
 #include "gdkglcontextprivate.h"
-#include "gdkdisplayprivate.h"
+#include "gdkdisplay-x11.h"
 #include "gdkvisual-x11.h"
 #include "gdksurface.h"
 #include "gdkinternals.h"
@@ -74,7 +74,7 @@ gboolean        gdk_x11_display_make_gl_context_current (GdkDisplay    *display,
 
 typedef struct _GdkX11GLContextGLX      GdkX11GLContextGLX;
 
-gboolean                gdk_x11_screen_init_glx                 (GdkX11Screen  *screen);
+gboolean                gdk_x11_display_init_glx                (GdkX11Display *display_x11);
 
 GType                   gdk_x11_gl_context_glx_get_type         (void) G_GNUC_CONST;
 GdkX11GLContext *       gdk_x11_gl_context_glx_new              (GdkSurface    *surface,
@@ -92,7 +92,8 @@ gboolean                gdk_x11_gl_context_glx_make_current     (GdkDisplay    *
 
 typedef struct _GdkX11GLContextEGL      GdkX11GLContextEGL;
 
-gboolean                gdk_x11_screen_init_egl                 (GdkX11Screen  *screen);
+gboolean                gdk_x11_display_init_egl                (GdkX11Display *display_x11);
+
 GType                   gdk_x11_gl_context_egl_get_type         (void) G_GNUC_CONST;
 GdkX11GLContext *       gdk_x11_gl_context_egl_new              (GdkSurface    *surface,
                                                                  gboolean       attached,


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