diff options
author | Sam Lantinga <slouken@libsdl.org> | 2015-03-30 11:31:53 -0700 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2015-03-30 11:31:53 -0700 |
commit | 0aee71db78eb37d1855b5ea86f1d03ccde21494d (patch) | |
tree | 34249e17f5cb8a23a87a4cd0d59f6e0dc1ea48f7 | |
parent | 7a17b275174fe4645fc96cc012c83918d827350a (diff) | |
download | sdl-0aee71db78eb37d1855b5ea86f1d03ccde21494d.tar.gz |
Fixed relative mouse motion moving farther and farther off screen.
-rw-r--r-- | src/events/SDL_mouse.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 0ce443a3c..326bbbadc 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -293,9 +293,14 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ event.motion.yrel = yrel; posted = (SDL_PushEvent(&event) > 0); } - /* Use unclamped values if we're getting events outside the window */ - mouse->last_x = x; - mouse->last_y = y; + if (relative) { + mouse->last_x = mouse->x; + mouse->last_y = mouse->y; + } else { + /* Use unclamped values if we're getting events outside the window */ + mouse->last_x = x; + mouse->last_y = y; + } return posted; } |