Bug 4581: move tracking appart so it doesn't require the window to have focus
authorSylvain Becker <sylvain.becker@gmail.com>
Sat, 06 Apr 2019 21:43:16 +0200
changeset 12697eabdcf59246a
parent 12696 3ef8a628853d
child 12698 0cc2592ed0f4
Bug 4581: move tracking appart so it doesn't require the window to have focus
src/events/SDL_touch.c
     1.1 --- a/src/events/SDL_touch.c	Fri Apr 05 08:15:01 2019 -0700
     1.2 +++ b/src/events/SDL_touch.c	Sat Apr 06 21:43:16 2019 +0200
     1.3 @@ -257,19 +257,26 @@
     1.4                          if (finger_touching == SDL_FALSE) {
     1.5                              int pos_x = (int)(x * (float)window->w);
     1.6                              int pos_y = (int)(y * (float)window->h);
     1.7 -                            finger_touching = SDL_TRUE;
     1.8 -                            track_touchid = id;
     1.9 -                            track_fingerid = fingerid;
    1.10                              SDL_SendMouseMotion(window, SDL_TOUCH_MOUSEID, 0, pos_x, pos_y);
    1.11                              SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);
    1.12                          }
    1.13                      } else {
    1.14                          if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
    1.15                              SDL_SendMouseButton(window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
    1.16 -                            finger_touching = SDL_FALSE;
    1.17                          }
    1.18                      }
    1.19                  }
    1.20 +                if (down) {
    1.21 +                    if (finger_touching == SDL_FALSE) {
    1.22 +                        finger_touching = SDL_TRUE;
    1.23 +                        track_touchid = id;
    1.24 +                        track_fingerid = fingerid;
    1.25 +                    }
    1.26 +                } else {
    1.27 +                    if (finger_touching == SDL_TRUE && track_touchid == id && track_fingerid == fingerid) {
    1.28 +                        finger_touching = SDL_FALSE;
    1.29 +                    }
    1.30 +                }
    1.31              }
    1.32          }
    1.33      }