Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Proximity events and evil-temporary makefile repair

  • Loading branch information
Szymon Wilczek committed Jul 2, 2008
1 parent 0f42551 commit b97ca87ea9a57ff2c0c90cd574fe8a86becb7002
Showing with 60 additions and 8 deletions.
  1. +2 −0 configure.in
  2. +16 −4 include/SDL_events.h
  3. +18 −0 src/events/SDL_mouse.c
  4. +13 −0 src/video/x11/SDL_x11events.c
  5. +11 −4 src/video/x11/SDL_x11video.c
@@ -1033,6 +1033,8 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
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
@@ -72,9 +72,11 @@ typedef enum
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 @@ typedef enum
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 @@ typedef struct SDL_ResizeEvent
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 @@ typedef union SDL_Event
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;
@@ -318,6 +318,24 @@ SDL_SetMouseFocus(int id, SDL_WindowID windowID)
}
}

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)
{
@@ -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 @@ X11_DispatchEvent(_THIS)
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
@@ -35,6 +35,7 @@ int SDL_NumOfXDevices;
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 @@ X11_VideoInit(_THIS)

/* 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 */

0 comments on commit b97ca87

Please sign in to comment.