Skip to content

Commit

Permalink
SDL: Preserve mouse position when switching between OpenGL and Surfac…
Browse files Browse the repository at this point in the history
…eSDL backends

Since those GraphcisManager initialize the cursor position to (0,0) when
created the cursor was jumping to the top left corner and then moving
back to its initial position as soon as the mouse was moved. Now it
stays at its initial position.

There are still some issues with it when changing between OpenGL and
SurfaceSDL at the same time as toggling fullscreen. But it is not worse
than before.
  • Loading branch information
criezy committed Nov 11, 2017
1 parent b93fefe commit 1d1f898
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backends/graphics/sdl/sdl-graphics.cpp
Expand Up @@ -32,7 +32,9 @@ SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *source, SdlWindow *window
#if SDL_VERSION_ATLEAST(2, 0, 0)
, _allowWindowSizeReset(false), _hintedWidth(0), _hintedHeight(0), _lastFlags(0)
#endif
{}
{
SDL_GetMouseState(&_cursorX, &_cursorY);
}

void SdlGraphicsManager::activateManager() {
_eventSource->setGraphicsManager(this);
Expand Down

0 comments on commit 1d1f898

Please sign in to comment.