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

upgraded functions

  • Loading branch information
Szymon Wilczek committed Aug 6, 2008
1 parent 231fdd6 commit 0f199b1ab8914dc476893e8bf42a2b5dd268a87d
Showing with 37 additions and 32 deletions.
  1. +7 −5 include/SDL_mouse.h
  2. +1 −1 src/SDL_compat.c
  3. +25 −22 src/events/SDL_mouse.c
  4. +4 −4 src/events/SDL_mouse_c.h
@@ -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)
@@ -92,7 +92,7 @@ extern DECLSPEC SDL_WindowID SDLCALL SDL_GetMouseFocusWindow(void);
*
* \sa SDL_GetRelativeMouseMode()
*/
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled, int index);
extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(int index, SDL_bool enabled);

/**
* \fn SDL_bool SDL_GetRelativeMouseMode()
@@ -101,7 +101,7 @@ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled, int index
*
* \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)
@@ -113,7 +113,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)
@@ -124,7 +124,7 @@ 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)
@@ -210,6 +210,8 @@ 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
@@ -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) {
@@ -174,9 +174,9 @@ SDL_SelectMouse(int index)
}

SDL_WindowID
SDL_GetMouseFocusWindow()
SDL_GetMouseFocusWindow(int index)
{
SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
SDL_Mouse *mouse = SDL_GetMouse(index);

if (!mouse) {
return 0;
@@ -196,7 +196,7 @@ FlushMouseMotion(void *param, SDL_Event * event)
}

int
SDL_SetRelativeMouseMode(SDL_bool enabled, int index)
SDL_SetRelativeMouseMode(int index, SDL_bool enabled)
{
SDL_Mouse *mouse = SDL_GetMouse(index);

@@ -224,9 +224,9 @@ SDL_SetRelativeMouseMode(SDL_bool enabled, int index)
}

SDL_bool
SDL_GetRelativeMouseMode()
SDL_GetRelativeMouseMode(int index)
{
SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
SDL_Mouse *mouse = SDL_GetMouse(index);

if (!mouse) {
return SDL_FALSE;
@@ -235,9 +235,9 @@ SDL_GetRelativeMouseMode()
}

Uint8
SDL_GetMouseState(int *x, int *y)
SDL_GetMouseState(int index, int *x, int *y)
{
SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
SDL_Mouse *mouse = SDL_GetMouse(index);

if (!mouse) {
if (x) {
@@ -259,9 +259,9 @@ SDL_GetMouseState(int *x, int *y)
}

Uint8
SDL_GetRelativeMouseState(int *x, int *y)
SDL_GetRelativeMouseState(int index, int *x, int *y)
{
SDL_Mouse *mouse = SDL_GetMouse(SDL_current_mouse);
SDL_Mouse *mouse = SDL_GetMouse(index);

if (!mouse) {
if (x) {
@@ -494,10 +494,6 @@ SDL_SendMouseButton(int id, Uint8 state, Uint8 button)
mouse->buttonstate |= SDL_BUTTON(button);
break;
case SDL_RELEASED:
//if (!(mouse->buttonstate & SDL_BUTTON(button))) {
// /* Ignore this event, no state change */
// return 0;
//}*/
type = SDL_MOUSEBUTTONUP;
mouse->buttonstate &= ~SDL_BUTTON(button);
break;
@@ -809,15 +805,22 @@ void SDL_ChangeEnd(int id, int end)

int SDL_GetCursorsNumber(int index)
{
if(index>=SDL_num_mice)
{
return -1;
}
if(SDL_mice[index]==NULL)
{
return -1;
}
return SDL_mice[index]->total_ends;
SDL_Mouse* mouse = SDL_GetMouse(index);
if(!mouse)
{
return -1;
}
return mouse->total_ends;
}

int SDL_GetCurrentCursor(int index)
{
SDL_Mouse* mouse = SDL_GetMouse(index);
if(!mouse)
{
return -1;
}
return mouse->current_end;
}
/* vi: set ts=4 sw=4 expandtab: */

@@ -108,16 +108,16 @@ extern void SDL_DelMouse(int index);
extern void SDL_ResetMouse(int index);

/* Set the mouse focus window */
extern void SDL_SetMouseFocus(int index, SDL_WindowID windowID);
extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);

/* Send a mouse motion event for a mouse at an index */
extern int SDL_SendMouseMotion(int index, int relative, int x, int y, int z);
extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);

/* Send a mouse button event for a mouse at an index */
extern int SDL_SendMouseButton(int index, Uint8 state, Uint8 button);
extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);

/* Send a mouse wheel event for a mouse at an index */
extern int SDL_SendMouseWheel(int index, int x, int y);
extern int SDL_SendMouseWheel(int id, int x, int y);

/* Shutdown the mouse subsystem */
extern void SDL_MouseQuit(void);

0 comments on commit 0f199b1

Please sign in to comment.