[gtk/wip.win32.fixes: 18/18] gdkdisplay.c: Fix builds without EGL




commit 685fb9dc2a7271b1b75c379a366b956e68affb66
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Oct 7 22:59:37 2021 +0800

    gdkdisplay.c: Fix builds without EGL
    
    We need to ensure that gdk_display_get_egl_display() is available even if EGL
    is not enabled in the build, so that things will continue to link and work.
    
    For builds without EGL, just return NULL.

 gdk/gdkdisplay.c | 54 +++++++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 25 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 075342a26b..e7b66abb35 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1406,31 +1406,6 @@ describe_egl_config (EGLDisplay egl_display,
 }
 #endif
 
-/*<private>
- * gdk_display_get_egl_display:
- * @self: a display
- *
- * Retrieves the EGL display connection object for the given GDK display.
- *
- * This function returns `NULL` if GL is not supported or GDK is using
- * a different OpenGL framework than EGL.
- *
- * Returns: (nullable): the EGL display object
- */
-gpointer
-gdk_display_get_egl_display (GdkDisplay *self)
-{
-  GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
-
-  g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
-
-  if (!priv->egl_display &&
-      !gdk_display_prepare_gl (self, NULL))
-    return NULL;
-
-  return priv->egl_display;
-}
-
 gpointer
 gdk_display_get_egl_config (GdkDisplay *self)
 {
@@ -1757,6 +1732,35 @@ gdk_display_init_egl (GdkDisplay  *self,
 }
 #endif
 
+/*<private>
+ * gdk_display_get_egl_display:
+ * @self: a display
+ *
+ * Retrieves the EGL display connection object for the given GDK display.
+ *
+ * This function returns `NULL` if GL is not supported or GDK is using
+ * a different OpenGL framework than EGL.
+ *
+ * Returns: (nullable): the EGL display object
+ */
+gpointer
+gdk_display_get_egl_display (GdkDisplay *self)
+{
+  GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
+
+  g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
+
+#ifdef HAVE_EGL
+  if (!priv->egl_display &&
+      !gdk_display_prepare_gl (self, NULL))
+    return NULL;
+
+  return priv->egl_display;
+#else
+  return NULL;
+#endif
+}
+
 GdkDebugFlags
 gdk_display_get_debug_flags (GdkDisplay *display)
 {


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