Proximity events and evil-temporary makefile repair gsoc2008_manymouse
authorSzymon Wilczek <kazeuser@gmail.com>
Wed, 02 Jul 2008 20:29:29 +0000
branchgsoc2008_manymouse
changeset 376381ea7d9a6624
parent 3762 f667489e7309
child 3764 2970fcfbdd54
Proximity events and evil-temporary makefile repair
configure.in
include/SDL_events.h
src/events/SDL_mouse.c
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11video.c
     1.1 --- a/configure.in	Wed Jul 02 20:20:51 2008 +0000
     1.2 +++ b/configure.in	Wed Jul 02 20:29:29 2008 +0000
     1.3 @@ -1033,6 +1033,8 @@
     1.4              SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
     1.5              EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
     1.6  
     1.7 +	    enable_x11_shared=no
     1.8 +
     1.9              if test x$enable_x11_shared = xmaybe; then
    1.10                  enable_x11_shared=$x11_symbols_private
    1.11              fi
     2.1 --- a/include/SDL_events.h	Wed Jul 02 20:20:51 2008 +0000
     2.2 +++ b/include/SDL_events.h	Wed Jul 02 20:29:29 2008 +0000
     2.3 @@ -72,9 +72,11 @@
     2.4      SDL_JOYBUTTONUP,            /**< Joystick button released */
     2.5      SDL_QUIT,                   /**< User-requested quit */
     2.6      SDL_SYSWMEVENT,             /**< System specific event */
     2.7 +    SDL_PROXIMITYIN,        /**< Proximity In event */
     2.8 +    SDL_PROXIMITYOUT,        /**< Proximity Out event */
     2.9      SDL_EVENT_RESERVED1,        /**< Reserved for future use... */
    2.10 -    SDL_EVENT_RESERVED2,        /**< Reserved for future use... */
    2.11 -    SDL_EVENT_RESERVED3,        /**< Reserved for future use... */
    2.12 +    SDL_EVENT_RESERVED2,
    2.13 +    SDL_EVENT_RESERVED3,
    2.14      /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
    2.15      SDL_USEREVENT = 24,
    2.16      /* This last event is only for bounding internal arrays
    2.17 @@ -112,7 +114,9 @@
    2.18          SDL_EVENTMASK(SDL_JOYHATMOTION) |
    2.19          SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP),
    2.20      SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
    2.21 -    SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
    2.22 +    SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT),
    2.23 +    SDL_PROXIMITYINMASK = SDL_EVENTMASK(SDL_PROXIMITYIN),
    2.24 +    SDL_PROXIMITYOUTMASK = SDL_EVENTMASK(SDL_PROXIMITYOUT)
    2.25  } SDL_EventMask;
    2.26  #define SDL_ALLEVENTS		0xFFFFFFFF
    2.27  
    2.28 @@ -317,6 +321,14 @@
    2.29      int h;
    2.30  } SDL_ResizeEvent;
    2.31  
    2.32 +typedef struct SDL_ProximityEvent
    2.33 +{
    2.34 +    Uint8 which;
    2.35 +    Uint8 type;
    2.36 +    int x;
    2.37 +    int y;
    2.38 +} SDL_ProximityEvent;
    2.39 +
    2.40  /**
    2.41   * \union SDL_Event
    2.42   *
    2.43 @@ -338,7 +350,7 @@
    2.44      SDL_QuitEvent quit;             /**< Quit request event data */
    2.45      SDL_UserEvent user;             /**< Custom event data */
    2.46      SDL_SysWMEvent syswm;           /**< System dependent window event data */
    2.47 -
    2.48 +    SDL_ProximityEvent proximity;    /**< Proximity In or Out event */
    2.49      /* Temporarily here for backwards compatibility */
    2.50      SDL_ActiveEvent active;
    2.51      SDL_ResizeEvent resize;
     3.1 --- a/src/events/SDL_mouse.c	Wed Jul 02 20:20:51 2008 +0000
     3.2 +++ b/src/events/SDL_mouse.c	Wed Jul 02 20:29:29 2008 +0000
     3.3 @@ -319,6 +319,24 @@
     3.4  }
     3.5  
     3.6  int
     3.7 +SDL_SendProximity(int id, int x, int y, int type)
     3.8 +{
     3.9 +    int index=SDL_GetIndexById(id);
    3.10 +    int posted=0;
    3.11 +    if(SDL_ProcessEvents[type]==SDL_ENABLE)
    3.12 +    {
    3.13 +        SDL_Event event;
    3.14 +        event.proximity.which=index;
    3.15 +        event.proximity.x=x;
    3.16 +        event.proximity.y=y;
    3.17 +        event.type=type;
    3.18 +        event.proximity.type=type;
    3.19 +        posted = (SDL_PushEvent(&event) > 0);
    3.20 +    }
    3.21 +    return posted;
    3.22 +}
    3.23 +
    3.24 +int
    3.25  SDL_SendMouseMotion(int id, int relative, int x, int y,int z)
    3.26  {
    3.27      int index=SDL_GetIndexById(id);
     4.1 --- a/src/video/x11/SDL_x11events.c	Wed Jul 02 20:20:51 2008 +0000
     4.2 +++ b/src/video/x11/SDL_x11events.c	Wed Jul 02 20:29:29 2008 +0000
     4.3 @@ -35,6 +35,9 @@
     4.4  extern int motion;
     4.5  extern int button_pressed;
     4.6  extern int button_released;
     4.7 +extern int proximity_in;
     4.8 +extern int proximity_out;
     4.9 +
    4.10  
    4.11  static void
    4.12  X11_DispatchEvent(_THIS)
    4.13 @@ -315,6 +318,16 @@
    4.14                  SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
    4.15                                  released->button);
    4.16              }
    4.17 +            else if(xevent.type==proximity_in)
    4.18 +            {
    4.19 +                XProximityNotifyEvent* proximity = (XProximityNotifyEvent*)&xevent;
    4.20 +                SDL_SendProximity(proximity->deviceid, proximity->x, proximity->y,SDL_PROXIMITYIN);
    4.21 +            }
    4.22 +            else if(xevent.type==proximity_out)
    4.23 +            {
    4.24 +                XProximityNotifyEvent* proximity = (XProximityNotifyEvent*)&xevent;
    4.25 +                SDL_SendProximity(proximity->deviceid, proximity->x, proximity->y,SDL_PROXIMITYOUT);
    4.26 +            }
    4.27              else
    4.28              {
    4.29  #ifdef DEBUG_XEVENTS
     5.1 --- a/src/video/x11/SDL_x11video.c	Wed Jul 02 20:20:51 2008 +0000
     5.2 +++ b/src/video/x11/SDL_x11video.c	Wed Jul 02 20:29:29 2008 +0000
     5.3 @@ -35,6 +35,7 @@
     5.4  XEventClass SDL_XEvents[256];
     5.5  int SDL_NumOfXEvents;
     5.6  int motion, button_pressed, button_released;
     5.7 +int proximity_in, proximity_out;
     5.8  
     5.9  /* Initialization/Query functions */
    5.10  static int X11_VideoInit(_THIS);
    5.11 @@ -277,17 +278,23 @@
    5.12  
    5.13  	/* proximity events */
    5.14  	ProximityIn(SDL_XDevices[i],c_not_needed,xEvent);
    5.15 -	if (xEvent) SDL_XEvents[index++] = xEvent;
    5.16 +	if (xEvent)
    5.17 +    {
    5.18 +        SDL_XEvents[index++] = xEvent;
    5.19 +        proximity_in=c_not_needed;
    5.20 +    }
    5.21  	ProximityOut(SDL_XDevices[i],c_not_needed,xEvent);
    5.22 -	if (xEvent) SDL_XEvents[index++] = xEvent;
    5.23 -
    5.24 +	if (xEvent)
    5.25 +    {
    5.26 +        SDL_XEvents[index++] = xEvent;
    5.27 +        proximity_out=c_not_needed;
    5.28 +    }
    5.29  	/* motion events */
    5.30  	DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent);
    5.31  	if (xEvent) 
    5.32      {
    5.33          SDL_XEvents[index++] = xEvent;
    5.34          motion=c_not_needed;
    5.35 -        //printf("motion: %d", c_not_needed);
    5.36      }
    5.37  
    5.38  	/* device state */