mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] app: move SDL mouse event handling out of main.c
This commit is contained in:
parent
a1069ddffa
commit
41a0cfe516
@ -81,6 +81,34 @@ static bool sdlEventFilter(SDL_Event * event)
|
||||
app_handleMouseNormal(event->motion.xrel, event->motion.yrel);
|
||||
return true;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
{
|
||||
int button = event->button.button;
|
||||
if (button > 3)
|
||||
button += 2;
|
||||
|
||||
app_handleButtonPress(button);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
{
|
||||
int button = event->button.button;
|
||||
if (button > 3)
|
||||
button += 2;
|
||||
|
||||
app_handleButtonRelease(button);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
int button = event->wheel.y > 0 ? 4 : 5;
|
||||
app_handleButtonPress(button);
|
||||
app_handleButtonRelease(button);
|
||||
return true;
|
||||
}
|
||||
|
||||
case SDL_WINDOWEVENT:
|
||||
switch(event->window.event)
|
||||
{
|
||||
|
@ -1445,40 +1445,6 @@ int eventFilter(void * userdata, SDL_Event * event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_MOUSEWHEEL:
|
||||
if (!app_inputEnabled() || !g_cursor.inView)
|
||||
break;
|
||||
|
||||
if (
|
||||
!spice_mouse_press (event->wheel.y > 0 ? 4 : 5) ||
|
||||
!spice_mouse_release(event->wheel.y > 0 ? 4 : 5)
|
||||
)
|
||||
{
|
||||
DEBUG_ERROR("SDL_MOUSEWHEEL: failed to send messages");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
{
|
||||
int button = event->button.button;
|
||||
if (button > 3)
|
||||
button += 2;
|
||||
|
||||
app_handleButtonPress(button);
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
{
|
||||
int button = event->button.button;
|
||||
if (button > 3)
|
||||
button += 2;
|
||||
|
||||
app_handleButtonRelease(button);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// consume all events
|
||||
|
Loading…
Reference in New Issue
Block a user