From da0a8db704f610994d665dfd7c080b49476ce76d Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 13 Sep 2017 00:43:56 -0500 Subject: BACKENDS: Also hide mouse cursor outside game area when an engine has hidden the cursor The only reason we show the system cursor outside the game area is to show users where their mouse is when the window is resized and the mouse is outside the game area. If the game cannot be interacted with, then the mouse also does not need to be shown in the black areas. --- backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 15 ++------------- backends/graphics/surfacesdl/surfacesdl-graphics.h | 2 -- 2 files changed, 2 insertions(+), 15 deletions(-) (limited to 'backends/graphics/surfacesdl') diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 52104ffb7a..f610922cc2 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -145,7 +145,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou #endif _overlayscreen(0), _tmpscreen2(0), _scalerProc(0), _screenChangeCount(0), - _mouseVisible(false), _mouseData(0), _mouseSurface(0), + _mouseData(0), _mouseSurface(0), _mouseOrigSurface(0), _cursorDontScale(false), _cursorPaletteDisabled(true), _currentShakePos(0), _newShakePos(0), _paletteDirtyStart(0), _paletteDirtyEnd(0), @@ -1863,17 +1863,6 @@ void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, in #pragma mark --- Mouse --- #pragma mark - -bool SurfaceSdlGraphicsManager::showMouse(bool visible) { - if (_mouseVisible == visible) - return visible; - - bool last = _mouseVisible; - _mouseVisible = visible; - _cursorNeedsRedraw = true; - - return last; -} - void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (!format) @@ -2123,7 +2112,7 @@ void SurfaceSdlGraphicsManager::undrawMouse() { } void SurfaceSdlGraphicsManager::drawMouse() { - if (!_mouseVisible || !_mouseSurface) { + if (!_cursorVisible || !_mouseSurface) { _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; return; } diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index c1e49b953a..0ed8d79296 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -129,7 +129,6 @@ public: virtual int16 getOverlayHeight() const override { return _videoMode.overlayHeight; } virtual int16 getOverlayWidth() const override { return _videoMode.overlayWidth; } - virtual bool showMouse(bool visible) override; virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) override; virtual void setCursorPalette(const byte *colors, uint start, uint num) override; @@ -318,7 +317,6 @@ protected: { } }; - bool _mouseVisible; byte *_mouseData; SDL_Rect _mouseBackup; MousePos _mouseCurState; -- cgit v1.2.3