Fixed relative mouse motion moving farther and farther off screen.
authorSam Lantinga <slouken@libsdl.org>
Mon, 30 Mar 2015 11:31:53 -0700
changeset 9448 3d3ed3a5ba8d
parent 9447 728a4bf8e02f
child 9449 a65088766e35
Fixed relative mouse motion moving farther and farther off screen.
src/events/SDL_mouse.c
--- a/src/events/SDL_mouse.c	Sat Mar 28 00:48:03 2015 -0400
+++ b/src/events/SDL_mouse.c	Mon Mar 30 11:31:53 2015 -0700
@@ -293,9 +293,14 @@
         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;
 }