Don't capture the cursor on a touch event

This commit is contained in:
Cameron Gutman 2020-04-24 21:26:59 -07:00
parent 8cf7f3ac08
commit 0892f0b0bb

View File

@ -612,25 +612,23 @@ void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event)
{ {
int button; int button;
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. // Capture the mouse again if clicked when unbound.
// We start capture on left button released instead of // We start capture on left button released instead of
// pressed to avoid sending an errant mouse button released // pressed to avoid sending an errant mouse button released
// event to the host when clicking into our window (since // event to the host when clicking into our window (since
// the pressed event was consumed by this code). // the pressed event was consumed by this code).
if (event->button == SDL_BUTTON_LEFT &&
event->state == SDL_RELEASED &&
!isCaptureActive()) {
setCaptureActive(true); setCaptureActive(true);
return;
} }
else if (!isCaptureActive()) {
// Not capturing // Not capturing
return; return;
} }
else if (event->which == SDL_TOUCH_MOUSEID) {
// Ignore synthetic mouse events
return;
}
switch (event->button) switch (event->button)
{ {