From eb7affeeb8f225cd228f92cdeb6a676ffddb0ef1 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Sat, 6 Apr 2019 21:52:51 +0200 Subject: [PATCH] SDL_HINT_MOUSE_TOUCH_EVENTS: move tracking appart in case of 'window' is null --- src/events/SDL_mouse.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 7799df797..259fd2e2a 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -486,14 +486,14 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state /* SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events */ if (mouse->mouse_touch_events) { if (mouseID != SDL_TOUCH_MOUSEID && button == SDL_BUTTON_LEFT) { + if (state == SDL_PRESSED) { + track_mouse_down = SDL_TRUE; + } else { + track_mouse_down = SDL_FALSE; + } if (window) { float fx = (float)mouse->x / (float)window->w; float fy = (float)mouse->y / (float)window->h; - if (state == SDL_PRESSED) { - track_mouse_down = SDL_TRUE; - } else { - track_mouse_down = SDL_FALSE; - } SDL_SendTouch(SDL_MOUSE_TOUCHID, 0, track_mouse_down, fx, fy, 1.0f); } }