diff --git a/client/displayservers/SDL/sdl.c b/client/displayservers/SDL/sdl.c index d811a340..ba0d0672 100644 --- a/client/displayservers/SDL/sdl.c +++ b/client/displayservers/SDL/sdl.c @@ -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) { diff --git a/client/src/main.c b/client/src/main.c index ca5db704..66d04b6a 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -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