From e53ff2a36d63c8764cb334d95c590a5197e2b20d Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 15:10:34 +0900 Subject: [PATCH] A bit of house keeping. --- libs/video/targets/context_x11.c | 10 +++++++ libs/video/targets/vid.c | 3 ++ libs/video/targets/vid_3dfxsvga.c | 2 -- libs/video/targets/vid_fbdev.c | 1 - libs/video/targets/vid_glx.c | 38 ++++++++++-------------- libs/video/targets/vid_sdl.c | 2 -- libs/video/targets/vid_sdl32.c | 2 -- libs/video/targets/vid_sgl.c | 2 -- libs/video/targets/vid_svgalib.c | 1 - libs/video/targets/vid_wgl.c | 2 -- libs/video/targets/vid_x11.c | 49 ++++++++++--------------------- 11 files changed, 44 insertions(+), 68 deletions(-) diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 4a4385d46..d0c617751 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -63,6 +63,7 @@ static __attribute__ ((used)) const char rcsid[] = # include #endif +#include "QF/cmd.h" #include "QF/cvar.h" #include "QF/input.h" #include "QF/qargs.h" @@ -482,9 +483,18 @@ X11_UpdateFullscreen (cvar_t *fullscreen) } } +static void +VID_Center_f (void) +{ + X11_ForceViewPort (); +} + + void X11_Init_Cvars (void) { + Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " + "quake window in a virtual desktop.\n"); vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ARCHIVE, &X11_UpdateFullscreen, "Toggles fullscreen game mode"); diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 96d941b37..6968757cb 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -39,6 +39,7 @@ static __attribute__ ((used)) const char rcsid[] = #endif #include +#include "QF/console.h" #include "QF/cvar.h" #include "QF/qargs.h" #include "QF/sys.h" @@ -165,6 +166,8 @@ VID_GetWindowSize (int def_w, int def_h) Cvar_Set (con_height, va ("%d", max (con_height->int_val, 200))); Cvar_SetFlags (con_height, con_height->flags | CVAR_ROM); vid.conheight = con_height->int_val; + + Con_CheckResize (); // Now that we have a window size, fix console } /* GAMMA FUNCTIONS */ diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index 833faee42..9c958fa25 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -303,8 +303,6 @@ VID_Init (unsigned char *palette) attribs[4] = 1; attribs[5] = FXMESA_NONE; - Con_CheckResize (); // Now that we have a window size, fix console - fc = qf_fxMesaCreateContext (0, findres (&vid.width, &vid.height), GR_REFRESH_75Hz, attribs); if (!fc) diff --git a/libs/video/targets/vid_fbdev.c b/libs/video/targets/vid_fbdev.c index 347f48d57..1f4a6af69 100644 --- a/libs/video/targets/vid_fbdev.c +++ b/libs/video/targets/vid_fbdev.c @@ -455,7 +455,6 @@ VID_Init (unsigned char *palette) current_mode = *vmode; ioctl(tty_fd, KDSETMODE, KD_GRAPHICS); VID_SetMode (current_mode.name, palette); - Con_CheckResize (); // Now that we have a window size, fix console VID_InitGamma (palette); VID_SetPalette (vid.palette); diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 6e2bceb3b..c01177956 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -55,7 +55,6 @@ static __attribute__ ((used)) const char rcsid[] = #endif #include "QF/cmd.h" -#include "QF/console.h" #include "QF/cvar.h" #include "QF/input.h" #include "QF/qargs.h" @@ -150,6 +149,21 @@ QFGL_LoadLibrary (void) } #endif // HAVE_DLOPEN +static void +glx_get_functions (void) +{ + GLF_Init (); + + qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); + qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", + true); + qfglXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext", + true); + qfglXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true); + + use_gl_procaddress = 1; +} + void VID_Shutdown (void) @@ -172,12 +186,6 @@ GL_EndRendering (void) Sbar_Changed (); } -static void -VID_Center_f (void) -{ - X11_ForceViewPort (); -} - void VID_Init (unsigned char *palette) { @@ -191,19 +199,7 @@ VID_Init (unsigned char *palette) None }; - GLF_Init (); - - qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); - qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", - true); - qfglXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext", - true); - qfglXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true); - - use_gl_procaddress = 1; - - Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " - "quake window in a virtual desktop.\n"); + glx_get_functions (); VID_GetWindowSize (640, 480); @@ -212,8 +208,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - Con_CheckResize (); // Now that we have a window size, fix console - X11_OpenDisplay (); x_visinfo = qfglXChooseVisual (x_disp, x_screen, attrib); diff --git a/libs/video/targets/vid_sdl.c b/libs/video/targets/vid_sdl.c index 1c7fbba5d..8169e82c8 100644 --- a/libs/video/targets/vid_sdl.c +++ b/libs/video/targets/vid_sdl.c @@ -122,8 +122,6 @@ VID_Init (unsigned char *palette) VID_InitBuffers (); // allocate z buffer and surface cache - Con_CheckResize (); // Now that we have a window size, fix console - SDL_ShowCursor (0); // hide the mouse pointer #ifdef _WIN32 diff --git a/libs/video/targets/vid_sdl32.c b/libs/video/targets/vid_sdl32.c index 859f66d31..a7d741872 100644 --- a/libs/video/targets/vid_sdl32.c +++ b/libs/video/targets/vid_sdl32.c @@ -165,8 +165,6 @@ VID_Init (unsigned char *palette) VID_InitBuffers (); // allocate z buffer and surface cache - Con_CheckResize (); // Now that we have a window size, fix console - SDL_ShowCursor (0); // initialize the mouse #ifdef _WIN32 diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index c50697d40..bf17bd02b 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -165,8 +165,6 @@ VID_Init (unsigned char *palette) SDL_Quit (); success: - Con_CheckResize (); // Now that we have a window size, fix console - vid.numpages = 2; GL_Init (); diff --git a/libs/video/targets/vid_svgalib.c b/libs/video/targets/vid_svgalib.c index 86e7ca673..0321355aa 100644 --- a/libs/video/targets/vid_svgalib.c +++ b/libs/video/targets/vid_svgalib.c @@ -383,7 +383,6 @@ VID_Init (unsigned char *palette) /* Set vid parameters */ VID_SetMode (current_mode, palette); - Con_CheckResize (); // Now that we have a window size, fix console VID_InitGamma (palette); VID_SetPalette (vid.palette); diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index 03a5b7633..7fc304343 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -538,8 +538,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - Con_CheckResize (); - #ifdef SPLASH_SCREEN if(hwnd_dialog) DestroyWindow (hwnd_dialog); diff --git a/libs/video/targets/vid_x11.c b/libs/video/targets/vid_x11.c index 79f57fb01..ac7a6050f 100644 --- a/libs/video/targets/vid_x11.c +++ b/libs/video/targets/vid_x11.c @@ -92,8 +92,6 @@ static XShmSegmentInfo x_shminfo[2]; static int current_framebuffer; static XImage *x_framebuffer[2] = { 0, 0 }; -static int verbose = 0; - int VID_options_items = 1; static byte current_palette[768]; @@ -384,13 +382,6 @@ x11_init_buffers (void) vid.conbuffer = vid.buffer; vid.conrowbytes = vid.rowbytes; - Con_CheckResize (); // Now that we have a window size, fix console -} - -static void -VID_Center_f (void) -{ - X11_ForceViewPort (); } /* @@ -408,22 +399,14 @@ VID_Init (unsigned char *palette) int num_visuals; int template_mask; - Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " - "quake window in a virtual desktop.\n"); - VID_GetWindowSize (320, 200); - vid.width = vid_width->int_val; - vid.height = vid_height->int_val; - vid.numpages = 2; vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); srandom (getpid ()); - verbose = COM_CheckParm ("-verbose"); - // open the display X11_OpenDisplay (); @@ -464,23 +447,21 @@ VID_Init (unsigned char *palette) } } - if (verbose) { - Sys_MaskPrintf (SYS_VID, "Using visualid %d:\n", - (int) x_visinfo->visualid); - Sys_MaskPrintf (SYS_VID, " class %d\n", x_visinfo->class); - Sys_MaskPrintf (SYS_VID, " screen %d\n", x_visinfo->screen); - Sys_MaskPrintf (SYS_VID, " depth %d\n", x_visinfo->depth); - Sys_MaskPrintf (SYS_VID, " red_mask 0x%x\n", - (int) x_visinfo->red_mask); - Sys_MaskPrintf (SYS_VID, " green_mask 0x%x\n", - (int) x_visinfo->green_mask); - Sys_MaskPrintf (SYS_VID, " blue_mask 0x%x\n", - (int) x_visinfo->blue_mask); - Sys_MaskPrintf (SYS_VID, " colormap_size %d\n", - x_visinfo->colormap_size); - Sys_MaskPrintf (SYS_VID, " bits_per_rgb %d\n", - x_visinfo->bits_per_rgb); - } + Sys_MaskPrintf (SYS_VID, "Using visualid %d:\n", + (int) x_visinfo->visualid); + Sys_MaskPrintf (SYS_VID, " class %d\n", x_visinfo->class); + Sys_MaskPrintf (SYS_VID, " screen %d\n", x_visinfo->screen); + Sys_MaskPrintf (SYS_VID, " depth %d\n", x_visinfo->depth); + Sys_MaskPrintf (SYS_VID, " red_mask 0x%x\n", + (int) x_visinfo->red_mask); + Sys_MaskPrintf (SYS_VID, " green_mask 0x%x\n", + (int) x_visinfo->green_mask); + Sys_MaskPrintf (SYS_VID, " blue_mask 0x%x\n", + (int) x_visinfo->blue_mask); + Sys_MaskPrintf (SYS_VID, " colormap_size %d\n", + x_visinfo->colormap_size); + Sys_MaskPrintf (SYS_VID, " bits_per_rgb %d\n", + x_visinfo->bits_per_rgb); /* Setup attributes for main window */ X11_SetVidMode (vid.width, vid.height);