Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Final merge of Google Summer of Code 2008 work...
Browse files Browse the repository at this point in the history
Many-mouse and tablet support
by Szymon Wilczek, mentored by Ryan C. Gordon

Everything concerning the project is noted on the wiki:
http://wilku.ravenlord.ws/doku.php?id=start
  • Loading branch information
slouken committed Aug 25, 2008
1 parent c00dabe commit b60dfec
Show file tree
Hide file tree
Showing 22 changed files with 806 additions and 268 deletions.
5 changes: 4 additions & 1 deletion configure.in
Expand Up @@ -1033,6 +1033,9 @@ 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"

echo "FIXME: Need to get dynamic loading of XInput working"
enable_x11_shared=no

if test x$enable_x11_shared = xmaybe; then
enable_x11_shared=$x11_symbols_private
fi
Expand All @@ -1055,7 +1058,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
else
enable_x11_shared=no
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext -lXi"
fi
have_video=yes

Expand Down
27 changes: 24 additions & 3 deletions include/SDL_events.h
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -170,6 +174,13 @@ typedef struct SDL_MouseMotionEvent
Uint8 state; /**< The current button state */
int x; /**< X coordinate, relative to window */
int y; /**< Y coordinate, relative to window */
int z; /**< Z coordinate, for future use */
int pressure; /**< Pressure reported by tablets */
int pressure_max; /**< Maximum value of the pressure reported by the device */
int pressure_min; /**< Minimum value of the pressure reported by the device */
int rotation; /**< For future use */
int tilt; /**< For future use */
int cursor; /**< The cursor being used in the event */
int xrel; /**< The relative motion in the X direction */
int yrel; /**< The relative motion in the Y direction */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
Expand Down Expand Up @@ -316,6 +327,15 @@ typedef struct SDL_ResizeEvent
int h;
} SDL_ResizeEvent;

typedef struct SDL_ProximityEvent
{
Uint8 type;
Uint8 which;
int cursor;
int x;
int y;
} SDL_ProximityEvent;

/**
* \union SDL_Event
*
Expand All @@ -337,6 +357,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;
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_keysym.h
Expand Up @@ -242,7 +242,7 @@ enum
SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN),
SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP),
SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP),
SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
};

/**
Expand Down
22 changes: 17 additions & 5 deletions include/SDL_mouse.h
Expand Up @@ -72,7 +72,7 @@ extern DECLSPEC int SDLCALL SDL_SelectMouse(int index);
*
* \brief Get the window which currently has focus for the currently selected mouse.
*/
extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(int index);

/**
* \fn int SDL_SetRelativeMouseMode(SDL_bool enabled)
Expand All @@ -92,7 +92,8 @@ extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
*
* \sa SDL_GetRelativeMouseMode()
*/
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index,
SDL_bool enabled);

/**
* \fn SDL_bool SDL_GetRelativeMouseMode()
Expand All @@ -101,7 +102,7 @@ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
*
* \sa SDL_SetRelativeMouseMode()
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(int index);

/**
* \fn Uint8 SDL_GetMouseState(int *x, int *y)
Expand All @@ -113,7 +114,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
* mouse cursor position relative to the focus window for the currently
* selected mouse. You can pass NULL for either x or y.
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int index, int *x, int *y);

/**
* \fn Uint8 SDL_GetRelativeMouseState(int *x, int *y)
Expand All @@ -124,7 +125,8 @@ extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int index, int *x,
int *y);

/**
* \fn void SDL_WarpMouseInWindow(SDL_WindowID windowID, int x, int y)
Expand Down Expand Up @@ -203,6 +205,16 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
Button 2: Middle mouse button
Button 3: Right mouse button
*/

/* FIXME: Where do these functions go in this header?
Also, add doxygen documentation for these...
*/
extern DECLSPEC char *SDLCALL SDL_GetMouseName(int index);

extern DECLSPEC int SDLCALL SDL_GetCursorsNumber(int index);

extern DECLSPEC int SDLCALL SDL_GetCurrentCursor(int index);

#define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1
#define SDL_BUTTON_MIDDLE 2
Expand Down
2 changes: 1 addition & 1 deletion src/SDL_compat.c
Expand Up @@ -256,7 +256,7 @@ SDL_CompatEventFilter(void *userdata, SDL_Event * event)
}

selected = SDL_SelectMouse(event->wheel.which);
SDL_GetMouseState(&x, &y);
SDL_GetMouseState(selected, &x, &y);
SDL_SelectMouse(selected);

if (event->wheel.y > 0) {
Expand Down

0 comments on commit b60dfec

Please sign in to comment.