From 2502afc3f636a4a428a0c91b401f61cbc5a32f37 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 26 Apr 2020 17:24:00 +1000 Subject: [PATCH] SDL: Hook up mouse button events to bindings --- src/duckstation-sdl/sdl_host_interface.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/duckstation-sdl/sdl_host_interface.cpp b/src/duckstation-sdl/sdl_host_interface.cpp index 0494f2a26..73c3c8a25 100644 --- a/src/duckstation-sdl/sdl_host_interface.cpp +++ b/src/duckstation-sdl/sdl_host_interface.cpp @@ -481,6 +481,18 @@ void SDLHostInterface::HandleSDLEvent(const SDL_Event* event) } break; + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEBUTTONUP: + { + if (!ImGui::GetIO().WantCaptureMouse) + { + const s32 button = static_cast(ZeroExtend32(event->button.button)); + const bool pressed = (event->type == SDL_MOUSEBUTTONDOWN); + HandleHostMouseEvent(button, pressed); + } + } + break; + case SDL_USEREVENT: { if (static_cast(event->user.code) == m_run_later_event_id)