[quake3] Re: additional vidModes
Erik Auerswald
auerswal at unix-ag.uni-kl.de
Fri Feb 10 05:17:40 EST 2006
Hi,
On Wed, Jan 18, 2006 at 11:37:26PM +0100, Bruno Kleinert wrote:
> would it even be possible, in windowed mode, to change the resolution by
> resizing the window? i can imagine this might be impossible because
> of that vid_restart q3 command...
The attached patch implements resizing the window. This is disabled by
default, to enable it add "+set r_allowResize 1" to the command line. A
change of this variable needs a vid_restart to take effect.
Resizing results in setting a custom resolution of the new window size
and a vid_restart.
I've tested it on linux/x86 with fvwm, OpenBox 3 and evilwm. These
window managers send a single resize event, so the call to vid_restart
for changing the resolution is unproblematic. Should a WM generate
many resize events for one real resize (to continuously update the
window content) this method does not work well.
Erik
-------------- next part --------------
Index: code/unix/sdl_glimp.c
===================================================================
--- code/unix/sdl_glimp.c (revision 537)
+++ code/unix/sdl_glimp.c (working copy)
@@ -124,6 +124,7 @@
cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims software
cvar_t *r_previousglDriver;
+cvar_t *r_allowResize; // make window resizable
qboolean GLimp_sdl_init_video(void)
{
@@ -386,6 +387,18 @@
case SDL_QUIT:
Sys_Quit();
break;
+
+ case SDL_VIDEORESIZE:
+ {
+ char width[10], height[10];
+ Com_sprintf( width, sizeof(width), "%d", e.resize.w );
+ Com_sprintf( height, sizeof(height), "%d", e.resize.h );
+ ri.Cvar_Set( "r_customwidth", width );
+ ri.Cvar_Set( "r_customheight", height );
+ ri.Cvar_Set( "r_mode", "-1" );
+ Cbuf_AddText( "vid_restart" );
+ }
+ break;
}
}
}
@@ -551,6 +564,9 @@
if (fullscreen)
flags |= SDL_FULLSCREEN;
+ if ( r_allowResize->integer )
+ flags |= SDL_RESIZABLE;
+
if (!r_colorbits->value)
colorbits = 24;
else
@@ -875,6 +891,8 @@
r_previousglDriver = ri.Cvar_Get( "r_previousglDriver", "", CVAR_ROM );
+ r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE );
+
InitSig();
IN_Init(); // rcg08312005 moved into glimp.
Index: README
===================================================================
--- README (revision 537)
+++ README (working copy)
@@ -115,6 +115,7 @@
ttycon_ansicolor - enable use of ANSI escape codes in the tty
r_GLlibCoolDownMsec - wait for some milliseconds to close GL library
+ r_allowResize - make window resizable
com_altivec - enable use of altivec on PowerPC systems
s_backend - read only, indicates the current sound backend
cl_consoleHistory - read only, stores the console history
More information about the quake3
mailing list