Don't hide cursor when window isn't focused

This commit is contained in:
Jonas Kulla 2013-09-25 20:35:00 +02:00
parent dff2d79a70
commit 35521c25c0
1 changed files with 7 additions and 6 deletions

View File

@ -71,6 +71,7 @@ void EventThread::process(RGSSThreadData &rtData)
fullscreen = rtData.config.fullscreen; fullscreen = rtData.config.fullscreen;
bool cursorInWindow = false; bool cursorInWindow = false;
bool windowFocused = false;
bool terminate = false; bool terminate = false;
@ -98,12 +99,12 @@ void EventThread::process(RGSSThreadData &rtData)
case SDL_WINDOWEVENT_ENTER : case SDL_WINDOWEVENT_ENTER :
cursorInWindow = true; cursorInWindow = true;
updateCursorState(cursorInWindow); updateCursorState(cursorInWindow && windowFocused);
break; break;
case SDL_WINDOWEVENT_LEAVE : case SDL_WINDOWEVENT_LEAVE :
cursorInWindow = false; cursorInWindow = false;
updateCursorState(cursorInWindow); updateCursorState(cursorInWindow && windowFocused);
break; break;
case SDL_WINDOWEVENT_CLOSE : case SDL_WINDOWEVENT_CLOSE :
@ -111,13 +112,13 @@ void EventThread::process(RGSSThreadData &rtData)
break; break;
case SDL_WINDOWEVENT_FOCUS_GAINED : case SDL_WINDOWEVENT_FOCUS_GAINED :
cursorInWindow = true; windowFocused = true;
updateCursorState(cursorInWindow); updateCursorState(cursorInWindow && windowFocused);
break; break;
case SDL_WINDOWEVENT_FOCUS_LOST : case SDL_WINDOWEVENT_FOCUS_LOST :
cursorInWindow = false; windowFocused = false;
updateCursorState(cursorInWindow); updateCursorState(cursorInWindow && windowFocused);
resetInputStates(); resetInputStates();
break; break;
} }