mirror of https://github.com/stella-emu/stella.git
Fixed grabmouse and show cursor to match Stella 3.9.3 functionality.
Added 'hidecursor' commandline option, to always disable showing the mouse cursor (useful for fullscreen-only frontends). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2908 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f7f80ff05b
commit
80bbfadb4c
|
@ -20,6 +20,10 @@
|
|||
context menu item to the debugger TIA output area. This saves the
|
||||
current TIA image to a PNG file.
|
||||
|
||||
* Added 'hidecursor' commandline option, which allows to completely
|
||||
disable showing the mouse cursor (useful on systems that don't have
|
||||
a mouse).
|
||||
|
||||
* Removed 'uipalette' option, as the original palette is no longer
|
||||
supported.
|
||||
|
||||
|
|
|
@ -1953,11 +1953,6 @@
|
|||
and always allows all 4 directions.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>FIXSDL-grabmouse <1|0></pre></td>
|
||||
<td>Keeps the mouse in the game window in emulation mode.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-usemouse <always|analog|never></pre></td>
|
||||
<td>Use mouse as a controller as specified by ROM properties in specific case.
|
||||
|
@ -1965,6 +1960,16 @@
|
|||
(paddles, trackball, etc).</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-grabmouse <1|0></pre></td>
|
||||
<td>Locks the mouse cursor in the game window in emulation mode.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-hidecursor <1|0></pre></td>
|
||||
<td>Always hide the mouse cursor, or show it when appropriate.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-dsense <number></pre></td>
|
||||
<td>Sensitivity for emulation of paddles when using a digital device
|
||||
|
|
|
@ -108,8 +108,9 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
|
|||
SDL_DestroyRenderer(myRenderer);
|
||||
myRenderer = NULL;
|
||||
}
|
||||
// Don't re-create the window if its size hasn't changed, as it is
|
||||
// wasteful, and causing flashing in fullscreen mode
|
||||
|
||||
// Don't re-create the window if its size hasn't changed, as it's not
|
||||
// necessary, and causes flashing in fullscreen mode
|
||||
if(myWindow)
|
||||
{
|
||||
int w, h;
|
||||
|
@ -120,8 +121,12 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode,
|
|||
myWindow = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!myWindow)
|
||||
if(myWindow)
|
||||
{
|
||||
// Even though window size stayed the same, the title may have changed
|
||||
SDL_SetWindowTitle(myWindow, title.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
int pos = myOSystem.settings().getBool("center")
|
||||
? SDL_WINDOWPOS_CENTERED : SDL_WINDOWPOS_UNDEFINED;
|
||||
|
@ -191,13 +196,13 @@ void FrameBufferSDL2::invalidate()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSDL2::showCursor(bool show)
|
||||
{
|
||||
//FIXSDL SDL_ShowCursor(show ? SDL_ENABLE : SDL_DISABLE);
|
||||
SDL_ShowCursor(show ? SDL_ENABLE : SDL_DISABLE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBufferSDL2::grabMouse(bool grab)
|
||||
{
|
||||
//FIXSDL SDL_WM_GrabInput(grab ? SDL_GRAB_ON : SDL_GRAB_OFF);
|
||||
SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -535,12 +535,14 @@ void FrameBuffer::refresh()
|
|||
case EventHandler::S_PAUSE:
|
||||
invalidate();
|
||||
drawTIA();
|
||||
#if 0 // FIXME: eliminate stuttering in TIA mode; do we really need this?
|
||||
if(isDoubleBuffered())
|
||||
{
|
||||
postFrameUpdate();
|
||||
invalidate();
|
||||
drawTIA();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EventHandler::S_MENU:
|
||||
|
@ -731,13 +733,12 @@ bool FrameBuffer::changeWindowedVidMode(int direction)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::setCursorState()
|
||||
{
|
||||
// Always grab mouse in fullscreen or during emulation (if enabled),
|
||||
// and don't show the cursor during emulation
|
||||
// Always grab mouse in emulation (if enabled),
|
||||
// and don't show the cursor during emulation (if enabled)
|
||||
bool emulation =
|
||||
myOSystem.eventHandler().state() == EventHandler::S_EMULATE;
|
||||
grabMouse(fullScreen() ||
|
||||
(emulation && myOSystem.settings().getBool("grabmouse")));
|
||||
showCursor(!emulation);
|
||||
grabMouse(emulation && myOSystem.settings().getBool("grabmouse"));
|
||||
showCursor(!(emulation || myOSystem.settings().getBool("hidecursor")));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -42,7 +42,6 @@ Settings::Settings(OSystem& osystem)
|
|||
setInternal("vsync", "true");
|
||||
setInternal("fullscreen", "false");
|
||||
setInternal("center", "false");
|
||||
setInternal("grabmouse", "true");
|
||||
setInternal("palette", "standard");
|
||||
setInternal("colorloss", "true");
|
||||
setInternal("timing", "sleep");
|
||||
|
@ -84,6 +83,8 @@ Settings::Settings(OSystem& osystem)
|
|||
setInternal("joydeadzone", "13");
|
||||
setInternal("joyallow4", "false");
|
||||
setInternal("usemouse", "analog");
|
||||
setInternal("grabmouse", "true");
|
||||
setInternal("hidecursor", "false");
|
||||
setInternal("dsense", "5");
|
||||
setInternal("msense", "7");
|
||||
setInternal("saport", "lr");
|
||||
|
@ -391,10 +392,11 @@ void Settings::usage()
|
|||
<< " -logtoconsole <1|0> Log output to console/commandline\n"
|
||||
<< " -joydeadzone <number> Sets 'deadzone' area for analog joysticks (0-29)\n"
|
||||
<< " -joyallow4 <1|0> Allow all 4 directions on a joystick to be pressed simultaneously\n"
|
||||
<< "FIXSDL -grabmouse <1|0> Keeps the mouse in the game window\n"
|
||||
<< " -usemouse <always|\n"
|
||||
<< " analog|\n"
|
||||
<< " never> Use mouse as a controller as specified by ROM properties in given mode(see manual)\n"
|
||||
<< " -grabmouse <1|0> Locks the mouse cursor in the TIA window\n"
|
||||
<< " -hidecursor <1|0> Always hide the cursor, or show it when appropriate\n"
|
||||
<< " -dsense <number> Sensitivity of digital emulated paddle movement (1-10)\n"
|
||||
<< " -msense <number> Sensitivity of mouse emulated paddle movement (1-15)\n"
|
||||
<< " -saport <lr|rl> How to assign virtual ports to multiple Stelladaptor/2600-daptors\n"
|
||||
|
|
|
@ -198,6 +198,15 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
|||
myGrabMouse->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
|
||||
// Hide mouse cursor
|
||||
ypos += lineHeight + 4;
|
||||
myHideCursor = new CheckboxWidget(myTab, font, xpos, ypos,
|
||||
"Always hide mouse cursor");
|
||||
wid.push_back(myHideCursor);
|
||||
#ifndef WINDOWED_SUPPORT
|
||||
myHideCursor->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
|
||||
// Add items for virtual device ports
|
||||
addToFocusList(wid, myTab, tabID);
|
||||
}
|
||||
|
@ -216,9 +225,6 @@ void InputDialog::loadConfig()
|
|||
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
|
||||
myDeadzoneLabel->setValue(Joystick::deadzone());
|
||||
|
||||
// Grab mouse
|
||||
myGrabMouse->setState(instance().settings().getBool("grabmouse"));
|
||||
|
||||
// Paddle speed (digital and mouse)
|
||||
myDPaddleSpeed->setValue(instance().settings().getInt("dsense"));
|
||||
myDPaddleLabel->setLabel(instance().settings().getString("dsense"));
|
||||
|
@ -231,6 +237,12 @@ void InputDialog::loadConfig()
|
|||
// Allow all 4 joystick directions
|
||||
myAllowAll4->setState(instance().settings().getBool("joyallow4"));
|
||||
|
||||
// Grab mouse
|
||||
myGrabMouse->setState(instance().settings().getBool("grabmouse"));
|
||||
|
||||
// Hide cursor
|
||||
myHideCursor->setState(instance().settings().getBool("hidecursor"));
|
||||
|
||||
myTab->loadConfig();
|
||||
}
|
||||
|
||||
|
@ -250,10 +262,6 @@ void InputDialog::saveConfig()
|
|||
instance().settings().setValue("joydeadzone", deadzone);
|
||||
Joystick::setDeadZone(deadzone);
|
||||
|
||||
// Grab mouse
|
||||
instance().settings().setValue("grabmouse", myGrabMouse->getState());
|
||||
instance().frameBuffer().setCursorState();
|
||||
|
||||
// Paddle speed (digital and mouse)
|
||||
int sensitivity = myDPaddleSpeed->getValue();
|
||||
instance().settings().setValue("dsense", sensitivity);
|
||||
|
@ -269,6 +277,11 @@ void InputDialog::saveConfig()
|
|||
bool allowall4 = myAllowAll4->getState();
|
||||
instance().settings().setValue("joyallow4", allowall4);
|
||||
instance().eventHandler().allowAllDirections(allowall4);
|
||||
|
||||
// Grab mouse and hide cursor
|
||||
instance().settings().setValue("grabmouse", myGrabMouse->getState());
|
||||
instance().settings().setValue("hidecursor", myHideCursor->getState());
|
||||
instance().frameBuffer().setCursorState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -296,9 +309,6 @@ void InputDialog::setDefaults()
|
|||
myDeadzone->setValue(0);
|
||||
myDeadzoneLabel->setValue(3200);
|
||||
|
||||
// Grab mouse
|
||||
myGrabMouse->setState(true);
|
||||
|
||||
// Paddle speed (digital and mouse)
|
||||
myDPaddleSpeed->setValue(5);
|
||||
myDPaddleLabel->setLabel("5");
|
||||
|
@ -311,6 +321,12 @@ void InputDialog::setDefaults()
|
|||
// Allow all 4 joystick directions
|
||||
myAllowAll4->setState(false);
|
||||
|
||||
// Grab mouse
|
||||
myGrabMouse->setState(true);
|
||||
|
||||
// Hide cursor
|
||||
myHideCursor->setState(false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ class InputDialog : public Dialog
|
|||
StaticTextWidget* myMPaddleLabel;
|
||||
CheckboxWidget* myAllowAll4;
|
||||
CheckboxWidget* myGrabMouse;
|
||||
CheckboxWidget* myHideCursor;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue