It seems that Alt-Tab support was intentially disabled if the "arch" cvar is "winnt" (which is Windows NT, Windows 2000, and Windows XP).
I took the attached patch mostly from Rich Stanway's Tremulous build and it seems to work fine on Windows 2000 (all I have to test with).
(In reply to comment #2)
> I'm hoping this will be resolved once we switch to sdl.
>
Will the SDL move be soon?
I ask because my patch needs work (plus a cvar to disable the behaviour). Should I bother resubmitting?
Comment 4Zachary J. Slater
2006-07-13 13:02:32 EDT
Not likely, unless I can find a programmer to do it. With regards to applying a cleaned up version of this patch, I haven't read it but if it isn't too hideous I don't mind.
Created attachment 959[details]
svn 816: fullscreen alt-tab support
This patch adds the cvar win_allowAltTab to toggle the new behaviour.
It also supports flipping between the Desktop resolution/colordepth and that of the game.
I have only tested on Windows 2000, but I have made a Tremulous .exe so I should be able to get feedback from other versions soon. http://trem.tjw.org/backport/
(In reply to comment #5)
> I have only tested on Windows 2000, but I have made a Tremulous .exe so I
> should be able to get feedback from other versions soon.
> http://trem.tjw.org/backport/
It seems some drivers, or perhaps just cards with low video ram have problems with this. When switching display resolution back to the one used for full screen textures become corrupted requiring /vid_restart.
Created attachment 1126[details]
svn951 win_allowAltTab
This is a different version of the same thing that is less hackish.
Also win_allowAltTab now defaults too 0 (off) because of the problems this feature causes on certain hardware/drivers.
It's still unclear to me if it's possible detect which hardware/drivers are incompatible with flipping back to fullscreen with ChangeDisplaySettings(). Possibly this is just a limitation of video memory? If this could be reliably detected, win_allowAltTab could default to on, we would just need to send a vid_restart cmd after switching from minimized to fullscreen.
Created attachment 1276[details]
svn1046 win_allowAltTab
I'm posting this patch for reference, not for inclusion.
Windows OpenGL drivers tend to be quite unpredictable and lame when
changing display resolution. Some drivers (e.g. ATI) tend to corrupt things that are important (e.g. texture memory).
This patch shows my attempt at reloading all textures from disk following a
change in display resolution. This gives mixed results because of other
lame behaviour in the OpenGL drivers I tested:
1) when texture memory is corrupted, simply reloading the texture with
glTexImage2D or glTexSubImage2D fails. The texture must be deleted
with glDeleteTextures before it can be reloaded.
2) If one of the textures has been modified with glTextSubImage2D (e.g.
the "*scratch" images), then calling glDeleteTextures can cause a crash
on some ATI drivers.
3) Reloading all the textures after a mode change stops corruption, but
but some textures are not visible in one of the older Rage Pro drivers
I tested
4) Simply changing resolution in one Rage Pro driver causes ioq3 to hang
occasionally.
If I could have achieved decent results from this process of reloading all
texture memory, I would pursue it further, but it all seems like this is just
a wasted effort.
At this point, I think the only reasonable solution for ioquake3 is to support
three win_allowAltTab settins:
0 - disabled
1 - do a vid_restart (the safe way)
2 - trust the OpenGL driver to do the right thing
I'm leaning towards 1 as being the default since I think this will be safe
on even the shittiest of display drivers. The only issue is that some users
may be accustomed to using Alt and Tab as binds, in which case they should
recieve a message that tells them how to disable Alt-Tab support anyway.
Created attachment 1281[details]
svn1048 cl_altTab / r_minimize / win_fastModeChange
This patch adds Alt-Tab support to win32 and SDL builds. It's controlled
with the following cvars:
cl_altTab [0|1] (default 1)
When non-0, hitting the key combination Alt-Tab will minimize ioq3 and restore
the desktop resolution. When ioq3 is un-minimized, the fullscreen
resolution is restored. On Mac and Win32, this only applies to fullscreen.
r_minimize [0|1] (always resets to 0)
Setting this to non-0 is the equivalent of the Alt-Tab key combination when
cl_altTab is enabled. Some users may choose to disable cl_altTab, and bind
another key to 'set r_minimize 1'.
win_fastModeChange [0|1] (default 0)
When set to non-0, the video display resolution change will not require a
vid_restart on win32. This can cause crashing or OpenGL context
corruption on some drivers. Unfortunately there doesn't seem to be a
good way to automatically detect if the driver handles this.
This still needs a lot of testing.
Because SDL_WM_IconfifyWindow() and SDL_WM_ToggleFullScreen() are
non-functional for Mac OS X, vid_restart is used. SDL with X11 can do the
mode change immediately (like win32 with win_fastModeChange enabled)
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.
--ryan.
TJW, just wanted to say this patch seems to work very well for most people. In the next build of ioUrbanTerror, I'm gonna enable win_fastmodechange by default, since most people like it so much.
Created attachment 1518[details]
svn1183 alt-tab patch
modified for unified SDL.
r_minimize - set this cvar to non-zero to immediatly minimize ioquake3
for example, "/bind o set r_minimize 1" (the o stands for
"omg my boss is coming into the room")
cl_altTab - set this to 1 (the default) to support Alt-Tab on all platforms
set it to non-1 and the Alt-Tab key combination will be disabled
on all platforms (even win32 when ioq3 has focus).
On Mac OS X, this is problematic because of a broken SDL_WM_IconfiyWindow() function in SDL <= 1.2.12 (see http://bugzilla.libsdl.org/show_bug.cgi?id=492)
But since we provide the Mac SDL .dylib in SVN anyway, it could just be updated.
I wonder if there was some way that r_minimize could be made to have persistent state, rather than acting as what is effectively a semaphore. I understand why you've done it this way (there is no obvious portable way to check when you're /not/ minimized), but I think this isn't a good way to use cvars.
Comment 14Zachary J. Slater
2010-10-19 02:26:12 EDT
I'd say: SDL problem. Furthermore we recently introduced /minimize command. As there doesn't seem to be any activity here, I'm going to close this bug.
Created attachment 957 [details] alt-tab support
Created attachment 1126 [details] svn951 win_allowAltTab This is a different version of the same thing that is less hackish. Also win_allowAltTab now defaults too 0 (off) because of the problems this feature causes on certain hardware/drivers. It's still unclear to me if it's possible detect which hardware/drivers are incompatible with flipping back to fullscreen with ChangeDisplaySettings(). Possibly this is just a limitation of video memory? If this could be reliably detected, win_allowAltTab could default to on, we would just need to send a vid_restart cmd after switching from minimized to fullscreen.
Created attachment 1276 [details] svn1046 win_allowAltTab I'm posting this patch for reference, not for inclusion. Windows OpenGL drivers tend to be quite unpredictable and lame when changing display resolution. Some drivers (e.g. ATI) tend to corrupt things that are important (e.g. texture memory). This patch shows my attempt at reloading all textures from disk following a change in display resolution. This gives mixed results because of other lame behaviour in the OpenGL drivers I tested: 1) when texture memory is corrupted, simply reloading the texture with glTexImage2D or glTexSubImage2D fails. The texture must be deleted with glDeleteTextures before it can be reloaded. 2) If one of the textures has been modified with glTextSubImage2D (e.g. the "*scratch" images), then calling glDeleteTextures can cause a crash on some ATI drivers. 3) Reloading all the textures after a mode change stops corruption, but but some textures are not visible in one of the older Rage Pro drivers I tested 4) Simply changing resolution in one Rage Pro driver causes ioq3 to hang occasionally. If I could have achieved decent results from this process of reloading all texture memory, I would pursue it further, but it all seems like this is just a wasted effort. At this point, I think the only reasonable solution for ioquake3 is to support three win_allowAltTab settins: 0 - disabled 1 - do a vid_restart (the safe way) 2 - trust the OpenGL driver to do the right thing I'm leaning towards 1 as being the default since I think this will be safe on even the shittiest of display drivers. The only issue is that some users may be accustomed to using Alt and Tab as binds, in which case they should recieve a message that tells them how to disable Alt-Tab support anyway.
Created attachment 1281 [details] svn1048 cl_altTab / r_minimize / win_fastModeChange This patch adds Alt-Tab support to win32 and SDL builds. It's controlled with the following cvars: cl_altTab [0|1] (default 1) When non-0, hitting the key combination Alt-Tab will minimize ioq3 and restore the desktop resolution. When ioq3 is un-minimized, the fullscreen resolution is restored. On Mac and Win32, this only applies to fullscreen. r_minimize [0|1] (always resets to 0) Setting this to non-0 is the equivalent of the Alt-Tab key combination when cl_altTab is enabled. Some users may choose to disable cl_altTab, and bind another key to 'set r_minimize 1'. win_fastModeChange [0|1] (default 0) When set to non-0, the video display resolution change will not require a vid_restart on win32. This can cause crashing or OpenGL context corruption on some drivers. Unfortunately there doesn't seem to be a good way to automatically detect if the driver handles this. This still needs a lot of testing. Because SDL_WM_IconfifyWindow() and SDL_WM_ToggleFullScreen() are non-functional for Mac OS X, vid_restart is used. SDL with X11 can do the mode change immediately (like win32 with win_fastModeChange enabled)