]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Cleanup some legacy cruft in vid_sdl.c
authorbones_was_here <bones_was_here@xonotic.au>
Sat, 7 Oct 2023 17:00:18 +0000 (03:00 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 28 Oct 2023 08:19:28 +0000 (18:19 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
vid.h
vid_sdl.c
vid_shared.c

diff --git a/vid.h b/vid.h
index 3cf85379894b389f21f6e581c65b4a653b4d7935..8ddf76c4ff6bff88c87b5ec46dd56d243f2455e2 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -178,18 +178,20 @@ extern struct cvar_s v_color_white_r;
 extern struct cvar_s v_color_white_g;
 extern struct cvar_s v_color_white_b;
 
+extern cvar_t gl_info_vendor;
+extern cvar_t gl_info_renderer;
+extern cvar_t gl_info_version;
+extern cvar_t gl_info_extensions;
+extern cvar_t gl_info_platform;
+extern cvar_t gl_info_driver;
+
 // brand of graphics chip
 extern const char *gl_vendor;
 // graphics chip model and other information
 extern const char *gl_renderer;
 // begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
 extern const char *gl_version;
-// extensions list, space separated
-extern const char *gl_extensions;
-// WGL, GLX, or AGL
-extern const char *gl_platform;
-// name of driver library (opengl32.dll, libGL.so.1, or whatever)
-extern char gl_driver[256];
+
 
 void *GL_GetProcAddress(const char *name);
 qbool GL_CheckExtension(const char *name, const char *disableparm, int silent);
index 91115ca1982ec3e8c4baf8ceab5fb4c7cca5434a..11cc4ac298702aa51f5bbcc2b9afabd8c9d7eba3 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -72,7 +72,6 @@ static qbool vid_usingmouse = false;
 static qbool vid_usingmouse_relativeworks = false; // SDL2 workaround for unimplemented RelativeMouse mode
 static qbool vid_usinghidecursor = false;
 static qbool vid_hasfocus = false;
-static qbool vid_isfullscreen;
 static qbool vid_usingvsync = false;
 static SDL_Joystick *vid_sdljoystick = NULL;
 static SDL_GameController *vid_sdlgamecontroller = NULL;
@@ -1349,7 +1348,6 @@ void VID_Init (void)
        vid_sdl_initjoysticksystem = SDL_InitSubSystem(SDL_INIT_JOYSTICK) >= 0;
        if (!vid_sdl_initjoysticksystem)
                Con_Printf(CON_ERROR "Failed to init SDL joystick subsystem: %s\n", SDL_GetError());
-       vid_isfullscreen = false;
 }
 
 static int vid_sdljoystickindex = -1;
@@ -1472,12 +1470,6 @@ static void AdjustWindowBounds(viddef_mode_t *mode, RECT *rect)
 }
 #endif
 
-extern cvar_t gl_info_vendor;
-extern cvar_t gl_info_renderer;
-extern cvar_t gl_info_version;
-extern cvar_t gl_info_platform;
-extern cvar_t gl_info_driver;
-
 static qbool VID_InitModeGL(viddef_mode_t *mode)
 {
        int windowflags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL;
@@ -1487,7 +1479,8 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        int yPos = SDL_WINDOWPOS_UNDEFINED;
        int i;
 #ifndef USE_GLES2
-       const char *drivername;
+       // SDL usually knows best
+       const char *drivername = NULL;
 #endif
 
        win_half_width = mode->width>>1;
@@ -1499,9 +1492,6 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        VID_OutputVersion();
 
 #ifndef USE_GLES2
-       // SDL usually knows best
-       drivername = NULL;
-
 // COMMANDLINEOPTION: SDL GL: -gl_driver <drivername> selects a GL driver library, default is whatever SDL recommends, useful only for 3dfxogl.dll/3dfxvgl.dll or fxmesa or similar, if you don't know what this is for, you don't need it
        i = Sys_CheckParm("-gl_driver");
        if (i && i < sys.argc - 1)
@@ -1520,40 +1510,41 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        windowflags |= SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS;
 #endif
 
-       vid_isfullscreen = false;
+
+       if (mode->fullscreen)
        {
-               if (mode->fullscreen) {
-                       if (vid_desktopfullscreen.integer)
-                       {
-                               vid_mode_t *m = VID_GetDesktopMode();
-                               mode->width = m->width;
-                               mode->height = m->height;
-                               windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
-                       }
-                       else
-                               windowflags |= SDL_WINDOW_FULLSCREEN;
-                       vid_isfullscreen = true;
+               if (vid_desktopfullscreen.integer)
+               {
+                       vid_mode_t *m = VID_GetDesktopMode();
+                       mode->width = m->width;
+                       mode->height = m->height;
+                       windowflags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
                }
-               else {
-                       if (vid_borderless.integer)
-                               windowflags |= SDL_WINDOW_BORDERLESS;
+               else
+                       windowflags |= SDL_WINDOW_FULLSCREEN;
+       }
+       else
+       {
+               if (vid_borderless.integer)
+                       windowflags |= SDL_WINDOW_BORDERLESS;
 #ifdef WIN32
-                       if (vid_ignore_taskbar.integer) {
-                               xPos = SDL_WINDOWPOS_CENTERED;
-                               yPos = SDL_WINDOWPOS_CENTERED;
-                       }
-                       else {
-                               RECT rect;
-                               AdjustWindowBounds(mode, &rect);
-                               xPos = rect.left;
-                               yPos = rect.top;
-                       }
-#endif
+               if (vid_ignore_taskbar.integer)
+               {
+                       xPos = SDL_WINDOWPOS_CENTERED;
+                       yPos = SDL_WINDOWPOS_CENTERED;
+               }
+               else
+               {
+                       RECT rect;
+                       AdjustWindowBounds(mode, &rect);
+                       xPos = rect.left;
+                       yPos = rect.top;
                }
+#endif
        }
-       //flags |= SDL_HWSURFACE;
 
-       if (vid_mouse_clickthrough.integer && !vid_isfullscreen)
+
+       if (vid_mouse_clickthrough.integer)
                SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
 
        SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
@@ -1604,16 +1595,14 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        SDL_GL_SetSwapInterval(bound(-1, vid_vsync.integer, 1));
        vid_usingvsync = (vid_vsync.integer != 0);
 
-       gl_platform = "SDL";
-
        GL_Setup();
 
        // VorteX: set other info
        Cvar_SetQuick(&gl_info_vendor, gl_vendor);
        Cvar_SetQuick(&gl_info_renderer, gl_renderer);
        Cvar_SetQuick(&gl_info_version, gl_version);
-       Cvar_SetQuick(&gl_info_platform, gl_platform ? gl_platform : "");
-       Cvar_SetQuick(&gl_info_driver, gl_driver);
+       Cvar_SetQuick(&gl_info_platform, "SDL");
+       Cvar_SetQuick(&gl_info_driver, drivername ? drivername : "");
 
        // clear to black (loading plaque will be seen over this)
        GL_Clear(GL_COLOR_BUFFER_BIT, NULL, 1.0f, 0);
@@ -1627,13 +1616,6 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        return true;
 }
 
-extern cvar_t gl_info_extensions;
-extern cvar_t gl_info_vendor;
-extern cvar_t gl_info_renderer;
-extern cvar_t gl_info_version;
-extern cvar_t gl_info_platform;
-extern cvar_t gl_info_driver;
-
 qbool VID_InitMode(viddef_mode_t *mode)
 {
        // GAME_STEELSTORM specific
@@ -1656,10 +1638,6 @@ void VID_Shutdown (void)
        window = NULL;
 
        SDL_QuitSubSystem(SDL_INIT_VIDEO);
-
-       gl_driver[0] = 0;
-       gl_extensions = "";
-       gl_platform = "";
 }
 
 void VID_Finish (void)
index 0b5c2d389b2f2ae8063abc0fb620a25a98c1580c..27e01c7023519083814bacf6e3314967d99f374e 100644 (file)
@@ -129,7 +129,7 @@ cvar_t gl_info_vendor = {CF_CLIENT | CF_READONLY, "gl_info_vendor", "", "indicat
 cvar_t gl_info_renderer = {CF_CLIENT | CF_READONLY, "gl_info_renderer", "", "indicates graphics chip model and other information"};
 cvar_t gl_info_version = {CF_CLIENT | CF_READONLY, "gl_info_version", "", "indicates version of current renderer. begins with 1.0.0, 1.1.0, 1.2.0, 1.3.1 etc."};
 cvar_t gl_info_extensions = {CF_CLIENT | CF_READONLY, "gl_info_extensions", "", "indicates extension list found by engine, space separated."};
-cvar_t gl_info_platform = {CF_CLIENT | CF_READONLY, "gl_info_platform", "", "indicates GL platform: WGL, GLX, or AGL."};
+cvar_t gl_info_platform = {CF_CLIENT | CF_READONLY, "gl_info_platform", "", "indicates GL platform: SDL, SDL, or SDL."};
 cvar_t gl_info_driver = {CF_CLIENT | CF_READONLY, "gl_info_driver", "", "name of driver library (opengl32.dll, libGL.so.1, or whatever)."};
 
 cvar_t vid_fullscreen = {CF_CLIENT | CF_ARCHIVE, "vid_fullscreen", "1", "use fullscreen (1) or windowed (0)"};
@@ -191,12 +191,6 @@ const char *gl_vendor;
 const char *gl_renderer;
 // begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
 const char *gl_version;
-// extensions list, space separated
-const char *gl_extensions;
-// WGL, GLX, or AGL
-const char *gl_platform;
-// name of driver library (opengl32.dll, libGL.so.1, or whatever)
-char gl_driver[256];
 
 #ifndef USE_GLES2
 GLboolean (GLAPIENTRY *qglIsBuffer) (GLuint buffer);