Modified -fullscreen commandline argument to accept an integer instead

of a boolean.  It now accepts value '-1' to mean 'completely disable
fullscreen mode switching'.  This was added because some systems with
buggy video drivers can't handle fullscreen mode, and accidentally
trying to do so can lock up such a system.

Fixed fullscreen/windowed switching wrt grabbing the mouse.  Sometimes
switching from fullscreen to windowed mode had the cursor trapped in
the window, even if grabmouse was disabled.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1852 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-08-07 11:45:14 +00:00
parent fe7dcb20db
commit 35ad585c48
6 changed files with 37 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -684,8 +684,9 @@
</tr>
<tr>
<td><pre>-fullscreen &lt;1|0&gt;</pre></td>
<td>Play the game in fullscreen mode.</td>
<td><pre>-fullscreen &lt;1|0|-1&gt;</pre></td>
<td>Play the game in fullscreen mode (1 or 0), or completely disable
fullscreen mode (-1).</td>
</tr>
<tr>

View File

@ -92,7 +92,7 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
// This must be done before any modes are initialized
mySDLFlags = 0;
#ifdef WINDOWED_SUPPORT
if(myOSystem->settings().getBool("fullscreen")) mySDLFlags = SDL_FULLSCREEN;
if(myOSystem->settings().getString("fullscreen") == "1") mySDLFlags = SDL_FULLSCREEN;
#endif
// Set the available video modes for this framebuffer
@ -121,7 +121,10 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
myScreenRect.setHeight(mode.screen_h);
// Did we get the requested fullscreen state?
myOSystem->settings().setBool("fullscreen", fullScreen());
const string& fullscreen = myOSystem->settings().getString("fullscreen");
if(fullscreen != "-1")
myOSystem->settings().setString("fullscreen", fullScreen() ? "1" : "0");
setCursorState();
}
}
else
@ -609,7 +612,8 @@ void FrameBuffer::toggleFullscreen()
void FrameBuffer::setFullscreen(bool enable)
{
#ifdef WINDOWED_SUPPORT
if(enable)
// '-1' means fullscreen mode is completely disabled
if(enable && myOSystem->settings().getString("fullscreen") != "-1" )
mySDLFlags |= SDL_FULLSCREEN;
else
mySDLFlags &= ~SDL_FULLSCREEN;
@ -654,11 +658,13 @@ bool FrameBuffer::changeVidMode(int direction)
myScreenRect.setHeight(vidmode.screen_h);
// Did we get the requested fullscreen state?
myOSystem->settings().setBool("fullscreen", fullScreen());
const string& fullscreen = myOSystem->settings().getString("fullscreen");
if(fullscreen != "-1")
myOSystem->settings().setString("fullscreen", fullScreen() ? "1" : "0");
setCursorState();
if(!inUIMode)
{
setCursorState();
if(direction != 0) // only show message when mode actually changes
showMessage(vidmode.gfxmode.description);
}
@ -701,6 +707,7 @@ void FrameBuffer::setCursorState()
break;
default:
showCursor(true);
break;
}
}

View File

@ -50,7 +50,7 @@ Settings::Settings(OSystem* osystem)
// Framebuffer-related options
setInternal("tia_filter", "zoom2x");
setInternal("fullscreen", "false");
setInternal("fullscreen", "0");
setInternal("fullres", "auto");
setInternal("center", "true");
setInternal("grabmouse", "false");
@ -329,7 +329,7 @@ void Settings::usage()
<< endl
#endif
<< " -tia_filter <filter> Use the specified filter in emulation mode\n"
<< " -fullscreen <1|0> Play the game in fullscreen mode\n"
<< " -fullscreen <1|0|-1> Use fullscreen mode (1 or 0), or disable switching to fullscreen entirely\n"
<< " -fullres <auto|WxH> The resolution to use in fullscreen mode\n"
<< " -center <1|0> Centers game window (if possible)\n"
<< " -grabmouse <1|0> Keeps the mouse in the game window\n"

View File

@ -56,7 +56,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
StringMap items;
// Set real dimensions
_w = 49 * fontWidth + 10;
_w = 52 * fontWidth + 10;
_h = 15 * (lineHeight + 4) + 10;
// The tab widget
@ -170,19 +170,24 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
// Add message concerning usage
ypos += (lineHeight + 4) * 2;
lwidth = font.getStringWidth("(*) Requires application restart");
new StaticTextWidget(myTab, font, 10, ypos, lwidth, fontHeight,
"(*) Requires application restart",
kTextAlignLeft);
new StaticTextWidget(myTab, font, 10, ypos,
font.getStringWidth("(*) Requires application restart"), fontHeight,
"(*) Requires application restart", kTextAlignLeft);
// Move over to the next column
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth() + 10;
ypos = 10;
// Fullscreen
myFullscreenCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
"Fullscreen mode", kFullScrChanged);
wid.push_back(myFullscreenCheckbox);
items.clear();
items.push_back("On", "1");
items.push_back("Off", "0");
items.push_back("Disabled", "-1");
lwidth = font.getStringWidth("Fullscreen: ");
myFullscreenPopup =
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "Fullscreen: ", lwidth, kFullScrChanged);
wid.push_back(myFullscreenPopup);
ypos += lineHeight + 4;
// PAL color-loss effect
@ -391,9 +396,9 @@ void VideoDialog::loadConfig()
instance().settings().getString("framerate"));
// Fullscreen
bool b = instance().settings().getBool("fullscreen");
myFullscreenCheckbox->setState(b);
handleFullscreenChange(b);
const string& fullscreen = instance().settings().getString("fullscreen");
myFullscreenPopup->setSelected(fullscreen, "0");
handleFullscreenChange(fullscreen == "1");
// PAL color-loss effect
myColorLossCheckbox->setState(instance().settings().getBool("colorloss"));
@ -488,7 +493,7 @@ void VideoDialog::saveConfig()
}
// Fullscreen
instance().settings().setBool("fullscreen", myFullscreenCheckbox->getState());
instance().settings().setString("fullscreen", myFullscreenPopup->getSelectedTag());
// PAL color-loss effect
instance().settings().setBool("colorloss", myColorLossCheckbox->getState());
@ -542,7 +547,7 @@ void VideoDialog::setDefaults()
myFrameRateSlider->setValue(0);
myFrameRateLabel->setLabel("0");
myFullscreenCheckbox->setState(false);
myFullscreenPopup->setSelected("0", "");
myColorLossCheckbox->setState(false);
myGLStretchCheckbox->setState(false);
myUseVSyncCheckbox->setState(true);
@ -601,7 +606,7 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kFullScrChanged:
handleFullscreenChange(myFullscreenCheckbox->getState());
handleFullscreenChange(myFullscreenPopup->getSelectedTag() == "1");
break;
default:

View File

@ -67,7 +67,7 @@ class VideoDialog : public Dialog
SliderWidget* myFrameRateSlider;
StaticTextWidget* myFrameRateLabel;
CheckboxWidget* myFullscreenCheckbox;
PopUpWidget* myFullscreenPopup;
CheckboxWidget* myColorLossCheckbox;
CheckboxWidget* myGLStretchCheckbox;
CheckboxWidget* myUseVSyncCheckbox;