mirror of https://github.com/stella-emu/stella.git
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:
parent
fe7dcb20db
commit
35ad585c48
Binary file not shown.
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.6 KiB |
|
@ -684,8 +684,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-fullscreen <1|0></pre></td>
|
<td><pre>-fullscreen <1|0|-1></pre></td>
|
||||||
<td>Play the game in fullscreen mode.</td>
|
<td>Play the game in fullscreen mode (1 or 0), or completely disable
|
||||||
|
fullscreen mode (-1).</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -92,7 +92,7 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
|
||||||
// This must be done before any modes are initialized
|
// This must be done before any modes are initialized
|
||||||
mySDLFlags = 0;
|
mySDLFlags = 0;
|
||||||
#ifdef WINDOWED_SUPPORT
|
#ifdef WINDOWED_SUPPORT
|
||||||
if(myOSystem->settings().getBool("fullscreen")) mySDLFlags = SDL_FULLSCREEN;
|
if(myOSystem->settings().getString("fullscreen") == "1") mySDLFlags = SDL_FULLSCREEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set the available video modes for this framebuffer
|
// 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);
|
myScreenRect.setHeight(mode.screen_h);
|
||||||
|
|
||||||
// Did we get the requested fullscreen state?
|
// 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
|
else
|
||||||
|
@ -609,7 +612,8 @@ void FrameBuffer::toggleFullscreen()
|
||||||
void FrameBuffer::setFullscreen(bool enable)
|
void FrameBuffer::setFullscreen(bool enable)
|
||||||
{
|
{
|
||||||
#ifdef WINDOWED_SUPPORT
|
#ifdef WINDOWED_SUPPORT
|
||||||
if(enable)
|
// '-1' means fullscreen mode is completely disabled
|
||||||
|
if(enable && myOSystem->settings().getString("fullscreen") != "-1" )
|
||||||
mySDLFlags |= SDL_FULLSCREEN;
|
mySDLFlags |= SDL_FULLSCREEN;
|
||||||
else
|
else
|
||||||
mySDLFlags &= ~SDL_FULLSCREEN;
|
mySDLFlags &= ~SDL_FULLSCREEN;
|
||||||
|
@ -654,11 +658,13 @@ bool FrameBuffer::changeVidMode(int direction)
|
||||||
myScreenRect.setHeight(vidmode.screen_h);
|
myScreenRect.setHeight(vidmode.screen_h);
|
||||||
|
|
||||||
// Did we get the requested fullscreen state?
|
// 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)
|
if(!inUIMode)
|
||||||
{
|
{
|
||||||
setCursorState();
|
|
||||||
if(direction != 0) // only show message when mode actually changes
|
if(direction != 0) // only show message when mode actually changes
|
||||||
showMessage(vidmode.gfxmode.description);
|
showMessage(vidmode.gfxmode.description);
|
||||||
}
|
}
|
||||||
|
@ -701,6 +707,7 @@ void FrameBuffer::setCursorState()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ Settings::Settings(OSystem* osystem)
|
||||||
|
|
||||||
// Framebuffer-related options
|
// Framebuffer-related options
|
||||||
setInternal("tia_filter", "zoom2x");
|
setInternal("tia_filter", "zoom2x");
|
||||||
setInternal("fullscreen", "false");
|
setInternal("fullscreen", "0");
|
||||||
setInternal("fullres", "auto");
|
setInternal("fullres", "auto");
|
||||||
setInternal("center", "true");
|
setInternal("center", "true");
|
||||||
setInternal("grabmouse", "false");
|
setInternal("grabmouse", "false");
|
||||||
|
@ -329,7 +329,7 @@ void Settings::usage()
|
||||||
<< endl
|
<< endl
|
||||||
#endif
|
#endif
|
||||||
<< " -tia_filter <filter> Use the specified filter in emulation mode\n"
|
<< " -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"
|
<< " -fullres <auto|WxH> The resolution to use in fullscreen mode\n"
|
||||||
<< " -center <1|0> Centers game window (if possible)\n"
|
<< " -center <1|0> Centers game window (if possible)\n"
|
||||||
<< " -grabmouse <1|0> Keeps the mouse in the game window\n"
|
<< " -grabmouse <1|0> Keeps the mouse in the game window\n"
|
||||||
|
|
|
@ -56,7 +56,7 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
StringMap items;
|
StringMap items;
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
_w = 49 * fontWidth + 10;
|
_w = 52 * fontWidth + 10;
|
||||||
_h = 15 * (lineHeight + 4) + 10;
|
_h = 15 * (lineHeight + 4) + 10;
|
||||||
|
|
||||||
// The tab widget
|
// The tab widget
|
||||||
|
@ -170,19 +170,24 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
|
|
||||||
// Add message concerning usage
|
// Add message concerning usage
|
||||||
ypos += (lineHeight + 4) * 2;
|
ypos += (lineHeight + 4) * 2;
|
||||||
lwidth = font.getStringWidth("(*) Requires application restart");
|
new StaticTextWidget(myTab, font, 10, ypos,
|
||||||
new StaticTextWidget(myTab, font, 10, ypos, lwidth, fontHeight,
|
font.getStringWidth("(*) Requires application restart"), fontHeight,
|
||||||
"(*) Requires application restart",
|
"(*) Requires application restart", kTextAlignLeft);
|
||||||
kTextAlignLeft);
|
|
||||||
|
|
||||||
// Move over to the next column
|
// Move over to the next column
|
||||||
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth() + 10;
|
xpos += myNAspectRatioSlider->getWidth() + myNAspectRatioLabel->getWidth() + 10;
|
||||||
ypos = 10;
|
ypos = 10;
|
||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
myFullscreenCheckbox = new CheckboxWidget(myTab, font, xpos, ypos,
|
items.clear();
|
||||||
"Fullscreen mode", kFullScrChanged);
|
items.push_back("On", "1");
|
||||||
wid.push_back(myFullscreenCheckbox);
|
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;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
// PAL color-loss effect
|
// PAL color-loss effect
|
||||||
|
@ -391,9 +396,9 @@ void VideoDialog::loadConfig()
|
||||||
instance().settings().getString("framerate"));
|
instance().settings().getString("framerate"));
|
||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
bool b = instance().settings().getBool("fullscreen");
|
const string& fullscreen = instance().settings().getString("fullscreen");
|
||||||
myFullscreenCheckbox->setState(b);
|
myFullscreenPopup->setSelected(fullscreen, "0");
|
||||||
handleFullscreenChange(b);
|
handleFullscreenChange(fullscreen == "1");
|
||||||
|
|
||||||
// PAL color-loss effect
|
// PAL color-loss effect
|
||||||
myColorLossCheckbox->setState(instance().settings().getBool("colorloss"));
|
myColorLossCheckbox->setState(instance().settings().getBool("colorloss"));
|
||||||
|
@ -488,7 +493,7 @@ void VideoDialog::saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
instance().settings().setBool("fullscreen", myFullscreenCheckbox->getState());
|
instance().settings().setString("fullscreen", myFullscreenPopup->getSelectedTag());
|
||||||
|
|
||||||
// PAL color-loss effect
|
// PAL color-loss effect
|
||||||
instance().settings().setBool("colorloss", myColorLossCheckbox->getState());
|
instance().settings().setBool("colorloss", myColorLossCheckbox->getState());
|
||||||
|
@ -542,7 +547,7 @@ void VideoDialog::setDefaults()
|
||||||
myFrameRateSlider->setValue(0);
|
myFrameRateSlider->setValue(0);
|
||||||
myFrameRateLabel->setLabel("0");
|
myFrameRateLabel->setLabel("0");
|
||||||
|
|
||||||
myFullscreenCheckbox->setState(false);
|
myFullscreenPopup->setSelected("0", "");
|
||||||
myColorLossCheckbox->setState(false);
|
myColorLossCheckbox->setState(false);
|
||||||
myGLStretchCheckbox->setState(false);
|
myGLStretchCheckbox->setState(false);
|
||||||
myUseVSyncCheckbox->setState(true);
|
myUseVSyncCheckbox->setState(true);
|
||||||
|
@ -601,7 +606,7 @@ void VideoDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFullScrChanged:
|
case kFullScrChanged:
|
||||||
handleFullscreenChange(myFullscreenCheckbox->getState());
|
handleFullscreenChange(myFullscreenPopup->getSelectedTag() == "1");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -67,7 +67,7 @@ class VideoDialog : public Dialog
|
||||||
|
|
||||||
SliderWidget* myFrameRateSlider;
|
SliderWidget* myFrameRateSlider;
|
||||||
StaticTextWidget* myFrameRateLabel;
|
StaticTextWidget* myFrameRateLabel;
|
||||||
CheckboxWidget* myFullscreenCheckbox;
|
PopUpWidget* myFullscreenPopup;
|
||||||
CheckboxWidget* myColorLossCheckbox;
|
CheckboxWidget* myColorLossCheckbox;
|
||||||
CheckboxWidget* myGLStretchCheckbox;
|
CheckboxWidget* myGLStretchCheckbox;
|
||||||
CheckboxWidget* myUseVSyncCheckbox;
|
CheckboxWidget* myUseVSyncCheckbox;
|
||||||
|
|
Loading…
Reference in New Issue