SDL: x11: Remove deprecated/defunct X11 hints

From 873ec097ea9d09d6fb8e50602e6d5d27fd5ff5b3 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 25 Nov 2022 16:37:57 -0500
Subject: [PATCH] x11: Remove deprecated/defunct X11 hints

SDL_HINT_VIDEO_X11_FORCE_EGL was deprecated in favor of the more general SDL_HINT_VIDEO_FORCE_EGL, and Xinerama and Xvidmode support was previously removed from SDL, rendering their associated hints nonfunctional.
---
 docs/README-migration.md        |  7 +++++++
 include/SDL_hints.h             | 32 --------------------------------
 src/video/x11/SDL_x11opengl.c   |  7 ++-----
 src/video/x11/SDL_x11opengles.c |  3 +--
 src/video/x11/SDL_x11video.c    |  3 +--
 src/video/x11/SDL_x11window.c   |  5 ++---
 6 files changed, 13 insertions(+), 44 deletions(-)

diff --git a/docs/README-migration.md b/docs/README-migration.md
index 524da783ce39..8131ed716319 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -158,3 +158,10 @@ SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in S
 SDL_SetWindowBrightness and SDL_SetWindowGammaRamp have been removed from the API, because they interact poorly with modern operating systems and aren't able to limit their effects to the SDL window.
 
 Programs which have access to shaders can implement more robust versions of those functions using custom shader code rendered as a post-process effect.
+
+## SDL_hints.h
+
+The following hints have been removed:
+* SDL_HINT_VIDEO_X11_FORCE_EGL (use SDL_HINT_VIDEO_FORCE_EGL instead)
+* SDL_HINT_VIDEO_X11_XINERAMA (Xinerama no longer supported by the X11 backend)
+* SDL_HINT_VIDEO_X11_XVIDMODE (Xvidmode no longer supported by the X11 backend)
diff --git a/include/SDL_hints.h b/include/SDL_hints.h
index cdd7414d341e..51ef52fd2668 100644
--- a/include/SDL_hints.h
+++ b/include/SDL_hints.h
@@ -1835,20 +1835,6 @@ extern "C" {
  */
 #define SDL_HINT_VIDEO_FORCE_EGL "SDL_VIDEO_FORCE_EGL"
 
-/**
- * \brief A variable controlling whether X11 should use GLX or EGL by default
- *
- * This variable can be set to the following values:
- * "0" - Use GLX
- * "1" - Use EGL
- *
- * By default SDL will use GLX when both are present.
- *
- * \deprecated Use the platform-agnostic SDL_HINT_VIDEO_FORCE_EGL hint instead.
- *
- */
-#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
-
 /**
  * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
  * 
@@ -1881,15 +1867,6 @@ extern "C" {
  */
 #define SDL_HINT_VIDEO_X11_WINDOW_VISUALID      "SDL_VIDEO_X11_WINDOW_VISUALID"
 
-/**
- *  \brief  A no-longer-used variable controlling whether the X11 Xinerama extension should be used.
- *
- * Before SDL 2.0.24, this would let apps and users disable Xinerama support on X11.
- *  Now SDL never uses Xinerama, and does not check for this hint at all.
- *  The preprocessor define is left here for source compatibility.
- */
-#define SDL_HINT_VIDEO_X11_XINERAMA         "SDL_VIDEO_X11_XINERAMA"
-
 /**
  *  \brief  A variable controlling whether the X11 XRandR extension should be used.
  *
@@ -1901,15 +1878,6 @@ extern "C" {
  */
 #define SDL_HINT_VIDEO_X11_XRANDR           "SDL_VIDEO_X11_XRANDR"
 
-/**
- *  \brief  A no-longer-used variable controlling whether the X11 VidMode extension should be used.
- *
- * Before SDL 2.0.24, this would let apps and users disable XVidMode support on X11.
- *  Now SDL never uses XVidMode, and does not check for this hint at all.
- *  The preprocessor define is left here for source compatibility.
- */
-#define SDL_HINT_VIDEO_X11_XVIDMODE         "SDL_VIDEO_X11_XVIDMODE"
-
 /**
  *  \brief  Controls how the fact chunk affects the loading of a WAVE file.
  *
diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c
index 5068c6ae743e..571c0ad50483 100644
--- a/src/video/x11/SDL_x11opengl.c
+++ b/src/video/x11/SDL_x11opengl.c
@@ -251,8 +251,7 @@ X11_GL_LoadLibrary(_THIS, const char *path)
      * GLX_EXT_create_context_es2_profile extension, switch over to X11_GLES functions  
      */
     if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) ||
-         SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE) ||
-         SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) &&
+         SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) &&
         X11_GL_UseEGL(_this) ) {
 #if SDL_VIDEO_OPENGL_EGL
         X11_GL_UnloadLibrary(_this);
@@ -690,9 +689,7 @@ SDL_bool
 X11_GL_UseEGL(_THIS)
 {
     SDL_assert(_this->gl_data != NULL);
-    if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE) ||
-        SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE))
-    {
+    if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) {
         /* use of EGL has been requested, even for desktop GL */
         return SDL_TRUE;
     }
diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c
index 8e7ffb0a00f8..f3a02356ebac 100644
--- a/src/video/x11/SDL_x11opengles.c
+++ b/src/video/x11/SDL_x11opengles.c
@@ -36,8 +36,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path)
 
     /* If the profile requested is not GL ES, switch over to X11_GL functions  */
     if ((_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) &&
-        !SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE) &&
-        !SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) {
+        !SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) {
         #if SDL_VIDEO_OPENGL_GLX
         X11_GLES_UnloadLibrary(_this);
         _this->GL_LoadLibrary = X11_GL_LoadLibrary;
diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c
index da303c6874b9..624db0059815 100644
--- a/src/video/x11/SDL_x11video.c
+++ b/src/video/x11/SDL_x11video.c
@@ -287,8 +287,7 @@ X11_CreateDevice(void)
 #endif
 #if SDL_VIDEO_OPENGL_EGL
 #if SDL_VIDEO_OPENGL_GLX
-    if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE) ||
-        SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) {
+    if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) {
 #endif
         device->GL_LoadLibrary = X11_GLES_LoadLibrary;
         device->GL_GetProcAddress = X11_GLES_GetProcAddress;
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 2d01208e7504..40713572959f 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -431,8 +431,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
 
 #if SDL_VIDEO_OPENGL_EGL
         if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) ||
-             SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE) ||
-             SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE))
+             SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE))
 #if SDL_VIDEO_OPENGL_GLX            
             && ( !_this->gl_data || X11_GL_UseEGL(_this) )
 #endif
@@ -654,7 +653,7 @@ X11_CreateWindow(_THIS, SDL_Window * window)
 #if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 || SDL_VIDEO_OPENGL_EGL
     if ((window->flags & SDL_WINDOW_OPENGL) && 
         ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) ||
-         SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE))
+         SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE))
 #if SDL_VIDEO_OPENGL_GLX            
         && ( !_this->gl_data || X11_GL_UseEGL(_this) )
 #endif