From a03279df3b7d819b90355125cdd0efa2e7329a8d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 14 Sep 2018 22:09:45 -0700 Subject: [PATCH] Fix errant mouse button event being sent on mouse capture --- app/streaming/input.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/streaming/input.cpp b/app/streaming/input.cpp index 6b6d59f8..41e46e50 100644 --- a/app/streaming/input.cpp +++ b/app/streaming/input.cpp @@ -394,9 +394,13 @@ void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event) { int button; - // Capture the mouse again if clicked when unbound + // Capture the mouse again if clicked when unbound. + // We start capture on left button released instead of + // pressed to avoid sending an errant mouse button released + // event to the host when clicking into our window (since + // the pressed event was consumed by this code). if (event->button == SDL_BUTTON_LEFT && - event->state == SDL_PRESSED && + event->state == SDL_RELEASED && !SDL_GetRelativeMouseMode()) { SDL_SetRelativeMouseMode(SDL_TRUE); return;