From 0892f0b0bbcb5aae6e79cbd59695d4d1df039057 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 24 Apr 2020 21:26:59 -0700 Subject: [PATCH] Don't capture the cursor on a touch event --- app/streaming/input.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/streaming/input.cpp b/app/streaming/input.cpp index 53648d49..29d3e16e 100644 --- a/app/streaming/input.cpp +++ b/app/streaming/input.cpp @@ -612,25 +612,23 @@ void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event) { int button; - // 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_RELEASED && - !isCaptureActive()) { - setCaptureActive(true); + if (event->which == SDL_TOUCH_MOUSEID) { + // Ignore synthetic mouse events return; } else if (!isCaptureActive()) { + if (event->button == SDL_BUTTON_LEFT && event->state == SDL_RELEASED) { + // 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). + setCaptureActive(true); + } + // Not capturing return; } - else if (event->which == SDL_TOUCH_MOUSEID) { - // Ignore synthetic mouse events - return; - } switch (event->button) {