Fixed bug 1663 - SDL_EventState(SDL_DOLLARGESTURE,SDL_IGNORE) etc. has no effect
authorSylvain Becker <sylvain.becker@gmail.com>
Sat, 24 Aug 2019 20:40:37 +0200
changeset 130347693573f862d
parent 13033 70bf772a32d7
child 13035 5748bf293bea
Fixed bug 1663 - SDL_EventState(SDL_DOLLARGESTURE,SDL_IGNORE) etc. has no effect
src/events/SDL_gesture.c
     1.1 --- a/src/events/SDL_gesture.c	Fri Aug 23 03:01:10 2019 +0300
     1.2 +++ b/src/events/SDL_gesture.c	Sat Aug 24 20:40:37 2019 +0200
     1.3 @@ -500,43 +500,48 @@
     1.4      return NULL;
     1.5  }
     1.6  
     1.7 -static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
     1.8 +static void SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist)
     1.9  {
    1.10 -    SDL_Event event;
    1.11 -    event.mgesture.type = SDL_MULTIGESTURE;
    1.12 -    event.mgesture.touchId = touch->id;
    1.13 -    event.mgesture.x = touch->centroid.x;
    1.14 -    event.mgesture.y = touch->centroid.y;
    1.15 -    event.mgesture.dTheta = dTheta;
    1.16 -    event.mgesture.dDist = dDist;
    1.17 -    event.mgesture.numFingers = touch->numDownFingers;
    1.18 -    return SDL_PushEvent(&event) > 0;
    1.19 +    if (SDL_GetEventState(SDL_MULTIGESTURE) == SDL_ENABLE) {
    1.20 +        SDL_Event event;
    1.21 +        event.mgesture.type = SDL_MULTIGESTURE;
    1.22 +        event.mgesture.touchId = touch->id;
    1.23 +        event.mgesture.x = touch->centroid.x;
    1.24 +        event.mgesture.y = touch->centroid.y;
    1.25 +        event.mgesture.dTheta = dTheta;
    1.26 +        event.mgesture.dDist = dDist;
    1.27 +        event.mgesture.numFingers = touch->numDownFingers;
    1.28 +        SDL_PushEvent(&event);
    1.29 +    }
    1.30  }
    1.31  
    1.32  #if defined(ENABLE_DOLLAR)
    1.33 -static int SDL_SendGestureDollar(SDL_GestureTouch* touch,
    1.34 +static void SDL_SendGestureDollar(SDL_GestureTouch* touch,
    1.35                            SDL_GestureID gestureId,float error)
    1.36  {
    1.37 -    SDL_Event event;
    1.38 -    event.dgesture.type = SDL_DOLLARGESTURE;
    1.39 -    event.dgesture.touchId = touch->id;
    1.40 -    event.dgesture.x = touch->centroid.x;
    1.41 -    event.dgesture.y = touch->centroid.y;
    1.42 -    event.dgesture.gestureId = gestureId;
    1.43 -    event.dgesture.error = error;
    1.44 -    /* A finger came up to trigger this event. */
    1.45 -    event.dgesture.numFingers = touch->numDownFingers + 1;
    1.46 -    return SDL_PushEvent(&event) > 0;
    1.47 +    if (SDL_GetEventState(SDL_DOLLARGESTURE) == SDL_ENABLE) {
    1.48 +        SDL_Event event;
    1.49 +        event.dgesture.type = SDL_DOLLARGESTURE;
    1.50 +        event.dgesture.touchId = touch->id;
    1.51 +        event.dgesture.x = touch->centroid.x;
    1.52 +        event.dgesture.y = touch->centroid.y;
    1.53 +        event.dgesture.gestureId = gestureId;
    1.54 +        event.dgesture.error = error;
    1.55 +        /* A finger came up to trigger this event. */
    1.56 +        event.dgesture.numFingers = touch->numDownFingers + 1;
    1.57 +        SDL_PushEvent(&event);
    1.58 +    }
    1.59  }
    1.60  
    1.61 -
    1.62 -static int SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
    1.63 +static void SDL_SendDollarRecord(SDL_GestureTouch* touch,SDL_GestureID gestureId)
    1.64  {
    1.65 -    SDL_Event event;
    1.66 -    event.dgesture.type = SDL_DOLLARRECORD;
    1.67 -    event.dgesture.touchId = touch->id;
    1.68 -    event.dgesture.gestureId = gestureId;
    1.69 -    return SDL_PushEvent(&event) > 0;
    1.70 +    if (SDL_GetEventState(SDL_DOLLARRECORD) == SDL_ENABLE) {
    1.71 +        SDL_Event event;
    1.72 +        event.dgesture.type = SDL_DOLLARRECORD;
    1.73 +        event.dgesture.touchId = touch->id;
    1.74 +        event.dgesture.gestureId = gestureId;
    1.75 +        SDL_PushEvent(&event);
    1.76 +    }
    1.77  }
    1.78  #endif
    1.79