Mercurial > sdl-ios-xcode
changeset 3763:81ea7d9a6624 gsoc2008_manymouse
Proximity events and evil-temporary makefile repair
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Wed, 02 Jul 2008 20:29:29 +0000 |
parents | f667489e7309 |
children | 2970fcfbdd54 |
files | configure.in include/SDL_events.h src/events/SDL_mouse.c src/video/x11/SDL_x11events.c src/video/x11/SDL_x11video.c |
diffstat | 5 files changed, 60 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Wed Jul 02 20:20:51 2008 +0000 +++ b/configure.in Wed Jul 02 20:29:29 2008 +0000 @@ -1033,6 +1033,8 @@ SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS" + enable_x11_shared=no + if test x$enable_x11_shared = xmaybe; then enable_x11_shared=$x11_symbols_private fi
--- a/include/SDL_events.h Wed Jul 02 20:20:51 2008 +0000 +++ b/include/SDL_events.h Wed Jul 02 20:29:29 2008 +0000 @@ -72,9 +72,11 @@ SDL_JOYBUTTONUP, /**< Joystick button released */ SDL_QUIT, /**< User-requested quit */ SDL_SYSWMEVENT, /**< System specific event */ + SDL_PROXIMITYIN, /**< Proximity In event */ + SDL_PROXIMITYOUT, /**< Proximity Out event */ SDL_EVENT_RESERVED1, /**< Reserved for future use... */ - SDL_EVENT_RESERVED2, /**< Reserved for future use... */ - SDL_EVENT_RESERVED3, /**< Reserved for future use... */ + SDL_EVENT_RESERVED2, + SDL_EVENT_RESERVED3, /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ SDL_USEREVENT = 24, /* This last event is only for bounding internal arrays @@ -112,7 +114,9 @@ SDL_EVENTMASK(SDL_JOYHATMOTION) | SDL_EVENTMASK(SDL_JOYBUTTONDOWN) | SDL_EVENTMASK(SDL_JOYBUTTONUP), SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), - SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) + SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT), + SDL_PROXIMITYINMASK = SDL_EVENTMASK(SDL_PROXIMITYIN), + SDL_PROXIMITYOUTMASK = SDL_EVENTMASK(SDL_PROXIMITYOUT) } SDL_EventMask; #define SDL_ALLEVENTS 0xFFFFFFFF @@ -317,6 +321,14 @@ int h; } SDL_ResizeEvent; +typedef struct SDL_ProximityEvent +{ + Uint8 which; + Uint8 type; + int x; + int y; +} SDL_ProximityEvent; + /** * \union SDL_Event * @@ -338,7 +350,7 @@ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ - + SDL_ProximityEvent proximity; /**< Proximity In or Out event */ /* Temporarily here for backwards compatibility */ SDL_ActiveEvent active; SDL_ResizeEvent resize;
--- a/src/events/SDL_mouse.c Wed Jul 02 20:20:51 2008 +0000 +++ b/src/events/SDL_mouse.c Wed Jul 02 20:29:29 2008 +0000 @@ -319,6 +319,24 @@ } int +SDL_SendProximity(int id, int x, int y, int type) +{ + int index=SDL_GetIndexById(id); + int posted=0; + if(SDL_ProcessEvents[type]==SDL_ENABLE) + { + SDL_Event event; + event.proximity.which=index; + event.proximity.x=x; + event.proximity.y=y; + event.type=type; + event.proximity.type=type; + posted = (SDL_PushEvent(&event) > 0); + } + return posted; +} + +int SDL_SendMouseMotion(int id, int relative, int x, int y,int z) { int index=SDL_GetIndexById(id);
--- a/src/video/x11/SDL_x11events.c Wed Jul 02 20:20:51 2008 +0000 +++ b/src/video/x11/SDL_x11events.c Wed Jul 02 20:29:29 2008 +0000 @@ -35,6 +35,9 @@ extern int motion; extern int button_pressed; extern int button_released; +extern int proximity_in; +extern int proximity_out; + static void X11_DispatchEvent(_THIS) @@ -315,6 +318,16 @@ SDL_SendMouseButton(released->deviceid, SDL_RELEASED, released->button); } + else if(xevent.type==proximity_in) + { + XProximityNotifyEvent* proximity = (XProximityNotifyEvent*)&xevent; + SDL_SendProximity(proximity->deviceid, proximity->x, proximity->y,SDL_PROXIMITYIN); + } + else if(xevent.type==proximity_out) + { + XProximityNotifyEvent* proximity = (XProximityNotifyEvent*)&xevent; + SDL_SendProximity(proximity->deviceid, proximity->x, proximity->y,SDL_PROXIMITYOUT); + } else { #ifdef DEBUG_XEVENTS
--- a/src/video/x11/SDL_x11video.c Wed Jul 02 20:20:51 2008 +0000 +++ b/src/video/x11/SDL_x11video.c Wed Jul 02 20:29:29 2008 +0000 @@ -35,6 +35,7 @@ XEventClass SDL_XEvents[256]; int SDL_NumOfXEvents; int motion, button_pressed, button_released; +int proximity_in, proximity_out; /* Initialization/Query functions */ static int X11_VideoInit(_THIS); @@ -277,17 +278,23 @@ /* proximity events */ ProximityIn(SDL_XDevices[i],c_not_needed,xEvent); - if (xEvent) SDL_XEvents[index++] = xEvent; + if (xEvent) + { + SDL_XEvents[index++] = xEvent; + proximity_in=c_not_needed; + } ProximityOut(SDL_XDevices[i],c_not_needed,xEvent); - if (xEvent) SDL_XEvents[index++] = xEvent; - + if (xEvent) + { + SDL_XEvents[index++] = xEvent; + proximity_out=c_not_needed; + } /* motion events */ DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent); if (xEvent) { SDL_XEvents[index++] = xEvent; motion=c_not_needed; - //printf("motion: %d", c_not_needed); } /* device state */