[client,sdl] use member instead of static variable

This commit is contained in:
Armin Novak 2023-07-31 09:12:07 +02:00 committed by akallabeth
parent b3fdebfdf7
commit ff26ca1e39
2 changed files with 5 additions and 10 deletions

View File

@ -472,22 +472,16 @@ BOOL sdlInput::keyboard_grab(Uint32 windowID, SDL_bool enable)
BOOL sdlInput::mouse_focus(Uint32 windowID)
{
static Uint32 lastWindowID = -1;
if (lastWindowID != windowID)
if (_lastWindowID != windowID)
{
lastWindowID = windowID;
_lastWindowID = windowID;
SDL_Window* window = SDL_GetWindowFromID(windowID);
if (!window)
return FALSE;
SDL_RaiseWindow(window);
return TRUE;
}
else
{
return TRUE;
};
return TRUE;
}
BOOL sdlInput::mouse_grab(Uint32 windowID, SDL_bool enable)
@ -506,7 +500,7 @@ BOOL sdlInput::mouse_grab(Uint32 windowID, SDL_bool enable)
#endif
}
sdlInput::sdlInput(SdlContext* sdl) : _sdl(sdl)
sdlInput::sdlInput(SdlContext* sdl) : _sdl(sdl), _lastWindowID(UINT32_MAX)
{
WINPR_ASSERT(_sdl);
}

View File

@ -47,4 +47,5 @@ class sdlInput
private:
SdlContext* _sdl;
Uint32 _lastWindowID;
};