Skip to content
Permalink
Browse files

sdl: workaround for not setting relative mouse location on some Andro…

…id Phones.
  • Loading branch information...
rafal1137 committed Oct 4, 2019
1 parent 056b0ab commit bcd93eda99de37078d0a8e20fe8e2a0aea79fe60
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/sdl/sdl_input.c
@@ -583,11 +583,16 @@ static void IN_GobbleMotionEvents(void)
static void IN_GrabMouse(qboolean grab, qboolean relative)
{
static qboolean mouse_grabbed = qfalse, mouse_relative = qfalse;
#ifndef __ANDROID__
int relative_result = 0;
#endif

if (relative == !mouse_relative)
{
SDL_ShowCursor(!relative);
#ifndef __ANDROID__
// On Android Phones with API <= 23 this is causing to App to close since it could not
// set relative mouse location (Mouse location is always at top left side of screen)
if ((relative_result = SDL_SetRelativeMouseMode((SDL_bool)relative)) != 0)
{
// FIXME: this happens on some systems (IR4)
@@ -600,6 +605,7 @@ static void IN_GrabMouse(qboolean grab, qboolean relative)
Com_Error(ERR_FATAL, "Setting relative mouse location fails: %s\n", SDL_GetError());
}
}
#endif
mouse_relative = relative;
}

0 comments on commit bcd93ed

Please sign in to comment.
You can’t perform that action at this time.