[Scummvm-git-logs] scummvm master -> 7da4faf5a59d16c5108b0c85e2a7399678678525
aquadran
aquadran at gmail.com
Thu Oct 22 15:03:58 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7da4faf5a5 SDL: Fix the mouse being grabbed when returning from full screen
Commit: 7da4faf5a59d16c5108b0c85e2a7399678678525
https://github.com/scummvm/scummvm/commit/7da4faf5a59d16c5108b0c85e2a7399678678525
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-10-22T17:03:53+02:00
Commit Message:
SDL: Fix the mouse being grabbed when returning from full screen
Changed paths:
backends/platform/sdl/sdl-window.cpp
backends/platform/sdl/sdl-window.h
diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index 2f8f4ea7f7..1799948513 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -32,13 +32,12 @@
static const uint32 fullscreenMask = SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN;
#endif
-SdlWindow::SdlWindow()
+SdlWindow::SdlWindow() :
#if SDL_VERSION_ATLEAST(2, 0, 0)
- : _window(nullptr), _windowCaption("ScummVM"),
- _lastFlags(0), _lastX(SDL_WINDOWPOS_UNDEFINED), _lastY(SDL_WINDOWPOS_UNDEFINED)
-#else
- : _inputGrabState(false), _inputLockState(false)
+ _window(nullptr), _windowCaption("ScummVM"),
+ _lastFlags(0), _lastX(SDL_WINDOWPOS_UNDEFINED), _lastY(SDL_WINDOWPOS_UNDEFINED),
#endif
+ _inputGrabState(false), _inputLockState(false)
{
#if SDL_VERSION_ATLEAST(2, 0, 0)
@@ -152,6 +151,7 @@ void SdlWindow::grabMouse(bool grab) {
if (_window) {
SDL_SetWindowGrab(_window, grab ? SDL_TRUE : SDL_FALSE);
}
+ _inputGrabState = grab;
#else
if (grab) {
_inputGrabState = true;
@@ -167,6 +167,7 @@ void SdlWindow::grabMouse(bool grab) {
bool SdlWindow::lockMouse(bool lock) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetRelativeMouseMode(lock ? SDL_TRUE : SDL_FALSE);
+ _inputLockState = lock;
#else
if (lock) {
_inputLockState = true;
@@ -265,7 +266,7 @@ SDL_Surface *copySDLSurface(SDL_Surface *src) {
}
bool SdlWindow::createOrUpdateWindow(int width, int height, uint32 flags) {
- if (mouseIsGrabbed()) {
+ if (_inputGrabState) {
flags |= SDL_WINDOW_INPUT_GRABBED;
}
diff --git a/backends/platform/sdl/sdl-window.h b/backends/platform/sdl/sdl-window.h
index ab5374c3c4..b84cbd6039 100644
--- a/backends/platform/sdl/sdl-window.h
+++ b/backends/platform/sdl/sdl-window.h
@@ -92,10 +92,8 @@ public:
if (_window) {
return SDL_GetWindowGrab(_window) == SDL_TRUE;
}
- return false;
-#else
- return _inputGrabState;
#endif
+ return _inputGrabState;
}
bool mouseIsLocked() const {
@@ -108,6 +106,7 @@ public:
private:
Common::Rect _desktopRes;
+ bool _inputGrabState, _inputLockState;
#if SDL_VERSION_ATLEAST(2, 0, 0)
public:
@@ -145,8 +144,6 @@ private:
int _lastX, _lastY;
Common::String _windowCaption;
-#else
- bool _inputGrabState, _inputLockState;
#endif
};
More information about the Scummvm-git-logs
mailing list