SDL: Only set the OpenGL flag if the OpenVR driver is active

From 1c51b8dc33f6e26227444508aee05ea99878e1a2 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 21 Oct 2024 15:07:43 -0700
Subject: [PATCH] Only set the OpenGL flag if the OpenVR driver is active

---
 src/video/SDL_video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index ceb4b6b9ef7c7..d8485ebf01f0e 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -277,6 +277,11 @@ static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this)
     if (_this->Metal_CreateView) {
         return SDL_WINDOW_METAL;
     }
+#endif
+#if defined(SDL_VIDEO_OPENGL) && defined(SDL_VIDEO_DRIVER_OPENVR)
+    if (SDL_strcmp(_this->name, "openvr") == 0) {
+        return SDL_WINDOW_OPENGL;
+    }
 #endif
     return 0;
 }
@@ -2342,10 +2347,6 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
         flags |= SDL_DefaultGraphicsBackends(_this);
     }
 
-#if defined(SDL_VIDEO_OPENGL) && defined(SDL_VIDEO_DRIVER_OPENVR)
-    flags |= SDL_WINDOW_OPENGL;
-#endif
-
     if (flags & SDL_WINDOW_OPENGL) {
         if (!_this->GL_CreateContext) {
             SDL_ContextNotSupported("OpenGL");