src/events/SDL_mouse.c
changeset 2849 523b10db69f8
parent 2842 97ba0be8b565
child 2859 99210400e8b9
     1.1 --- a/src/events/SDL_mouse.c	Sun Dec 07 07:16:40 2008 +0000
     1.2 +++ b/src/events/SDL_mouse.c	Sun Dec 07 21:53:28 2008 +0000
     1.3 @@ -364,21 +364,6 @@
     1.4          if (!focus) {
     1.5              SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0);
     1.6          }
     1.7 -        SDL_GetWindowSize(windowID, &mouse->x_max, &mouse->y_max);
     1.8 -    }
     1.9 -}
    1.10 -
    1.11 -void
    1.12 -SDL_SetMouseFocusSize(SDL_WindowID windowID, int w, int h)
    1.13 -{
    1.14 -    int i;
    1.15 -
    1.16 -    for (i = 0; i < SDL_num_mice; ++i) {
    1.17 -        SDL_Mouse *mouse = SDL_GetMouse(i);
    1.18 -        if (mouse && mouse->focus == windowID) {
    1.19 -            mouse->x_max = w;
    1.20 -            mouse->y_max = h;
    1.21 -        }
    1.22      }
    1.23  }
    1.24  
    1.25 @@ -458,15 +443,19 @@
    1.26      } else {
    1.27          /* while using the relative mode and many windows, we have to be
    1.28             sure that the pointers find themselves inside the windows */
    1.29 -        if (mouse->x + xrel > mouse->x_max) {
    1.30 -            mouse->x = mouse->x_max;
    1.31 +        int x_max, y_max;
    1.32 +
    1.33 +        SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
    1.34 +
    1.35 +        if (mouse->x + xrel > x_max) {
    1.36 +            mouse->x = x_max;
    1.37          } else if (mouse->x + xrel < 0) {
    1.38              mouse->x = 0;
    1.39          } else {
    1.40              mouse->x += xrel;
    1.41          }
    1.42 -        if (mouse->y + yrel > mouse->y_max) {
    1.43 -            mouse->y = mouse->y_max;
    1.44 +        if (mouse->y + yrel > y_max) {
    1.45 +            mouse->y = y_max;
    1.46          } else if (mouse->y + yrel < 0) {
    1.47              mouse->y = 0;
    1.48          } else {