瀏覽代碼

Fixed relative mouse motion moving farther and farther off screen.

Sam Lantinga 10 年之前
父節點
當前提交
236deab49b
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      src/events/SDL_mouse.c

+ 8 - 3
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;
 }