mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client] wayland: move wayland specific mouse code out of main.c
This commit is contained in:
@@ -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:
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user