diff src/events/SDL_mouse.c @ 2849:523b10db69f8

There's no reason to add extra code to notify the mice of window size changes. Just query the window size when we care about it. :)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 07 Dec 2008 21:53:28 +0000
parents 97ba0be8b565
children 99210400e8b9
line wrap: on
line diff
--- a/src/events/SDL_mouse.c	Sun Dec 07 07:16:40 2008 +0000
+++ b/src/events/SDL_mouse.c	Sun Dec 07 21:53:28 2008 +0000
@@ -364,21 +364,6 @@
         if (!focus) {
             SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
         }
-        SDL_GetWindowSize(windowID, &mouse->x_max, &mouse->y_max);
-    }
-}
-
-void
-SDL_SetMouseFocusSize(SDL_WindowID windowID, int w, int h)
-{
-    int i;
-
-    for (i = 0; i < SDL_num_mice; ++i) {
-        SDL_Mouse *mouse = SDL_GetMouse(i);
-        if (mouse && mouse->focus == windowID) {
-            mouse->x_max = w;
-            mouse->y_max = h;
-        }
     }
 }
 
@@ -458,15 +443,19 @@
     } else {
         /* while using the relative mode and many windows, we have to be
            sure that the pointers find themselves inside the windows */
-        if (mouse->x + xrel > mouse->x_max) {
-            mouse->x = mouse->x_max;
+        int x_max, y_max;
+
+        SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
+
+        if (mouse->x + xrel > x_max) {
+            mouse->x = x_max;
         } else if (mouse->x + xrel < 0) {
             mouse->x = 0;
         } else {
             mouse->x += xrel;
         }
-        if (mouse->y + yrel > mouse->y_max) {
-            mouse->y = mouse->y_max;
+        if (mouse->y + yrel > y_max) {
+            mouse->y = y_max;
         } else if (mouse->y + yrel < 0) {
             mouse->y = 0;
         } else {