Fixed relative mouse motion moving farther and farther off screen.
authorSam Lantinga <slouken@libsdl.org>
Mon, 30 Mar 2015 11:31:53 -0700
changeset 94483d3ed3a5ba8d
parent 9447 728a4bf8e02f
child 9449 a65088766e35
Fixed relative mouse motion moving farther and farther off screen.
src/events/SDL_mouse.c
     1.1 --- a/src/events/SDL_mouse.c	Sat Mar 28 00:48:03 2015 -0400
     1.2 +++ b/src/events/SDL_mouse.c	Mon Mar 30 11:31:53 2015 -0700
     1.3 @@ -293,9 +293,14 @@
     1.4          event.motion.yrel = yrel;
     1.5          posted = (SDL_PushEvent(&event) > 0);
     1.6      }
     1.7 -    /* Use unclamped values if we're getting events outside the window */
     1.8 -    mouse->last_x = x;
     1.9 -    mouse->last_y = y;
    1.10 +    if (relative) {
    1.11 +        mouse->last_x = mouse->x;
    1.12 +        mouse->last_y = mouse->y;
    1.13 +    } else {
    1.14 +        /* Use unclamped values if we're getting events outside the window */
    1.15 +        mouse->last_x = x;
    1.16 +        mouse->last_y = y;
    1.17 +    }
    1.18      return posted;
    1.19  }
    1.20