Sharpened code looks and a minor events upgrade gsoc2008_manymouse
authorSzymon Wilczek
Wed, 06 Aug 2008 09:29:32 +0000
branchgsoc2008_manymouse
changeset 377754d08ecec1cb
parent 3776 a9c2a7071874
child 3778 a9370b995ded
Sharpened code looks and a minor events upgrade
include/SDL_events.h
src/events/SDL_mouse.c
src/video/x11/SDL_x11mouse.c
     1.1 --- a/include/SDL_events.h	Wed Aug 06 08:48:43 2008 +0000
     1.2 +++ b/include/SDL_events.h	Wed Aug 06 09:29:32 2008 +0000
     1.3 @@ -331,6 +331,7 @@
     1.4  {
     1.5      Uint8 which;
     1.6      Uint8 type;
     1.7 +    int cursor;
     1.8      int x;
     1.9      int y;
    1.10  } SDL_ProximityEvent;
     2.1 --- a/src/events/SDL_mouse.c	Wed Aug 06 08:48:43 2008 +0000
     2.2 +++ b/src/events/SDL_mouse.c	Wed Aug 06 09:29:32 2008 +0000
     2.3 @@ -338,6 +338,7 @@
     2.4  SDL_SendProximity(int id, int x, int y, int type)
     2.5  {
     2.6      int index=SDL_GetIndexById(id);
     2.7 +    SDL_Mouse* mouse=SDL_GetMouse(index);
     2.8      int posted=0;
     2.9  	last_x=x;
    2.10  	last_y=y;
    2.11 @@ -347,23 +348,24 @@
    2.12          event.proximity.which=(Uint8)index;
    2.13          event.proximity.x=x;
    2.14          event.proximity.y=y;
    2.15 +        event.proximity.cursor=mouse->current_end;
    2.16          event.type=type;
    2.17          event.proximity.type=type;
    2.18          posted = (SDL_PushEvent(&event) > 0);
    2.19          if(type==SDL_PROXIMITYIN)
    2.20          {
    2.21 -            SDL_mice[index]->proximity=SDL_TRUE;
    2.22 +            mouse->proximity=SDL_TRUE;
    2.23          }
    2.24          else
    2.25          {
    2.26 -            SDL_mice[index]->proximity=SDL_FALSE;
    2.27 +            mouse->proximity=SDL_FALSE;
    2.28          }
    2.29      }
    2.30      return posted;
    2.31  }
    2.32  
    2.33  int
    2.34 -SDL_SendMouseMotion(int id, int relative, int x, int y,int z)
    2.35 +SDL_SendMouseMotion(int id, int relative, int x, int y,int pressure)
    2.36  {
    2.37      int index=SDL_GetIndexById(id);
    2.38      SDL_Mouse *mouse = SDL_GetMouse(index);
    2.39 @@ -440,7 +442,7 @@
    2.40      }
    2.41      mouse->xdelta += xrel;
    2.42      mouse->ydelta += yrel;
    2.43 -    mouse->pressure=z;
    2.44 +    mouse->pressure=pressure;
    2.45  
    2.46      /* Move the mouse cursor, if needed */
    2.47      if (mouse->cursor_shown && !mouse->relative_mode &&
    2.48 @@ -450,7 +452,8 @@
    2.49  
    2.50      /* Post the event, if desired */
    2.51      posted = 0;
    2.52 -    if (SDL_ProcessEvents[SDL_MOUSEMOTION] == SDL_ENABLE && SDL_mice[index]->proximity==SDL_TRUE) {
    2.53 +    if (SDL_ProcessEvents[SDL_MOUSEMOTION] == SDL_ENABLE && \
    2.54 +            mouse->proximity==SDL_TRUE) {
    2.55          SDL_Event event;
    2.56          event.motion.type = SDL_MOUSEMOTION;
    2.57  		event.motion.which = (Uint8) index;
     3.1 --- a/src/video/x11/SDL_x11mouse.c	Wed Aug 06 08:48:43 2008 +0000
     3.2 +++ b/src/video/x11/SDL_x11mouse.c	Wed Aug 06 09:29:32 2008 +0000
     3.3 @@ -59,7 +59,7 @@
     3.4                      if(!newDevices)
     3.5                      {
     3.6                          SDL_OutOfMemory();
     3.7 -                        return -1;
     3.8 +                        return;
     3.9                      }
    3.10                      SDL_XDevices=newDevices;
    3.11                      SDL_XDevices[index]=XOpenDevice(data->display,DevList[i].id);