[client] wayland: move wayland specific mouse code out of main.c

This commit is contained in:
Geoffrey McRae
2021-01-16 20:17:19 +11:00
parent a4a042e90d
commit ef678bab1d
4 changed files with 66 additions and 62 deletions

View File

@@ -63,6 +63,12 @@ static bool sdlEventFilter(SDL_Event * event)
// stop motion events during the warp out of the window
if (sdl.exiting)
return true;
app_updateCursorPos(event->motion.x, event->motion.y);
if (app_cursorIsGrabbed())
app_handleMouseGrabbed(event->motion.xrel, event->motion.yrel);
else
app_handleMouseNormal(event->motion.xrel, event->motion.yrel);
break;
case SDL_WINDOWEVENT:

View File

@@ -356,6 +356,19 @@ static void waylandFree(void)
static bool waylandEventFilter(SDL_Event * event)
{
/* prevent the default processing for the following events */
switch(event->type)
{
case SDL_MOUSEMOTION:
{
app_updateCursorPos(event->motion.x, event->motion.y);
// we must use the basic handler as Wayland has no warp support
app_handleMouseBasic(event->motion.x, event->motion.y);
return true;
}
}
return false;
}