SDL: video: Convert some EGL environment variables to SDL hints.

From 1f54b228ff7ce0ce93f49cbda869b93f247a01a9 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 6 Jan 2025 11:15:26 -0500
Subject: [PATCH] video: Convert some EGL environment variables to SDL hints.

Fixes #10479.
---
 include/SDL3/SDL_hints.h | 15 ++++++++++++++-
 src/video/SDL_egl.c      |  4 ++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h
index 8f8db4615fc0b..f3686934e7ff5 100644
--- a/include/SDL3/SDL_hints.h
+++ b/include/SDL3/SDL_hints.h
@@ -2635,12 +2635,25 @@ extern "C" {
  * Specify the OpenGL library to load.
  *
  * This hint should be set before creating an OpenGL window or creating an
- * OpenGL context.
+ * OpenGL context. If this hint isn't set, SDL will choose a reasonable
+ * default.
  *
  * \since This hint is available since SDL 3.1.3.
  */
 #define SDL_HINT_OPENGL_LIBRARY "SDL_OPENGL_LIBRARY"
 
+/**
+ * Specify the EGL library to load.
+ *
+ * This hint should be set before creating an OpenGL window or creating an
+ * OpenGL context. This hint is only considered if SDL is using EGL to
+ * manage OpenGL contexts. If this hint isn't set, SDL will choose a
+ * reasonable default.
+ *
+ * \since This hint is available since SDL 3.2.0.
+ */
+#define SDL_HINT_EGL_LIBRARY "SDL_EGL_LIBRARY"
+
 /**
  * A variable controlling what driver to use for OpenGL ES contexts.
  *
diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c
index e3128b3e3fd86..edeb033fc2ebf 100644
--- a/src/video/SDL_egl.c
+++ b/src/video/SDL_egl.c
@@ -344,7 +344,7 @@ static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_
 
 #if !defined(SDL_VIDEO_STATIC_ANGLE) && !defined(SDL_VIDEO_DRIVER_VITA)
     /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */
-    path = SDL_getenv("SDL_VIDEO_GL_DRIVER");
+    path = SDL_GetHint(SDL_HINT_OPENGL_LIBRARY);
     if (path) {
         opengl_dll_handle = SDL_LoadObject(path);
     }
@@ -404,7 +404,7 @@ static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_
         if (egl_dll_handle) {
             SDL_UnloadObject(egl_dll_handle);
         }
-        path = SDL_getenv("SDL_VIDEO_EGL_DRIVER");
+        path = SDL_GetHint(SDL_HINT_EGL_LIBRARY);
         if (!path) {
             path = DEFAULT_EGL;
         }