Skip to content

Commit

Permalink
Changed SDL_GetAbsoluteMouseState() to SDL_GetGlobalMouseState().
Browse files Browse the repository at this point in the history
This matches naming conventions in the main repository, between
 SDL_GetRelativeMouseState() and SDL_WarpMouseGlobal().
  • Loading branch information
icculus committed Jun 25, 2014
1 parent 2cce7b2 commit 8436956
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/SDL_mouse.h
Expand Up @@ -100,7 +100,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
*
* \sa SDL_GetMouseState
*/
extern DECLSPEC Uint32 SDLCALL SDL_GetAbsoluteMouseState(int *x, int *y);
extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);

/**
* \brief Retrieve the relative state of the mouse.
Expand Down
2 changes: 1 addition & 1 deletion src/dynapi/SDL_dynapi_overrides.h
Expand Up @@ -581,4 +581,4 @@
#define SDL_WinRTRunApp SDL_WinRTRunApp_REAL
#define SDL_CaptureMouse SDL_CaptureMouse_REAL
#define SDL_SetWindowHitTest SDL_SetWindowHitTest_REAL
#define SDL_GetAbsoluteMouseState SDL_GetAbsoluteMouseState_REAL
#define SDL_GetGlobalMouseState SDL_GetGlobalMouseState_REAL
2 changes: 1 addition & 1 deletion src/dynapi/SDL_dynapi_procs.h
Expand Up @@ -614,4 +614,4 @@ SDL_DYNAPI_PROC(int,SDL_WinRTRunApp,(int a, char **b, void *c),(a,b,c),return)
#endif
SDL_DYNAPI_PROC(int,SDL_CaptureMouse,(SDL_bool a),(a),return)
SDL_DYNAPI_PROC(int,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return)
SDL_DYNAPI_PROC(Uint32,SDL_GetAbsoluteMouseState,(int *a, int *b),(a,b),return)
SDL_DYNAPI_PROC(Uint32,SDL_GetGlobalMouseState,(int *a, int *b),(a,b),return)
6 changes: 3 additions & 3 deletions src/events/SDL_mouse.c
Expand Up @@ -470,7 +470,7 @@ SDL_GetRelativeMouseState(int *x, int *y)
}

Uint32
SDL_GetAbsoluteMouseState(int *x, int *y)
SDL_GetGlobalMouseState(int *x, int *y)
{
SDL_Mouse *mouse = SDL_GetMouse();
int tmpx, tmpy;
Expand All @@ -485,12 +485,12 @@ SDL_GetAbsoluteMouseState(int *x, int *y)

*x = *y = 0;

if (!mouse->GetAbsoluteMouseState) {
if (!mouse->GetGlobalMouseState) {
SDL_assert(0 && "This should really be implemented for every target.");
return 0;
}

return mouse->GetAbsoluteMouseState(x, y);
return mouse->GetGlobalMouseState(x, y);
}

void
Expand Down
2 changes: 1 addition & 1 deletion src/events/SDL_mouse_c.h
Expand Up @@ -67,7 +67,7 @@ typedef struct
int (*CaptureMouse) (SDL_Window * window);

/* Get absolute mouse coordinates. (x) and (y) are never NULL and set to zero before call. */
Uint32 (*GetAbsoluteMouseState) (int *x, int *y);
Uint32 (*GetGlobalMouseState) (int *x, int *y);

/* Data common to all mice */
SDL_MouseID mouseID;
Expand Down
2 changes: 1 addition & 1 deletion src/test/SDL_test_common.c
Expand Up @@ -1492,7 +1492,7 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done)
if (withControl) {
/* Ctrl-A reports absolute mouse position. */
int x, y;
const Uint32 mask = SDL_GetAbsoluteMouseState(&x, &y);
const Uint32 mask = SDL_GetGlobalMouseState(&x, &y);
SDL_Log("ABSOLUTE MOUSE: (%d, %d)%s%s%s%s%s\n", x, y,
(mask & SDL_BUTTON_LMASK) ? " [LBUTTON]" : "",
(mask & SDL_BUTTON_MMASK) ? " [MBUTTON]" : "",
Expand Down
4 changes: 2 additions & 2 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -283,7 +283,7 @@ + (NSCursor *)invisibleCursor
}

static Uint32
Cocoa_GetAbsoluteMouseState(int *x, int *y)
Cocoa_GetGlobalMouseState(int *x, int *y)
{
const NSUInteger cocoaButtons = [NSEvent pressedMouseButtons];
const NSPoint cocoaLocation = [NSEvent mouseLocation];
Expand Down Expand Up @@ -321,7 +321,7 @@ + (NSCursor *)invisibleCursor
mouse->WarpMouse = Cocoa_WarpMouse;
mouse->SetRelativeMouseMode = Cocoa_SetRelativeMouseMode;
mouse->CaptureMouse = Cocoa_CaptureMouse;
mouse->GetAbsoluteMouseState = Cocoa_GetAbsoluteMouseState;
mouse->GetGlobalMouseState = Cocoa_GetGlobalMouseState;

SDL_SetDefaultCursor(Cocoa_CreateDefaultCursor());

Expand Down
4 changes: 2 additions & 2 deletions src/video/windows/SDL_windowsmouse.c
Expand Up @@ -261,7 +261,7 @@ WIN_CaptureMouse(SDL_Window *window)
}

static Uint32
WIN_GetAbsoluteMouseState(int *x, int *y)
WIN_GetGlobalMouseState(int *x, int *y)
{
Uint32 retval = 0;
POINT pt = { 0, 0 };
Expand Down Expand Up @@ -290,7 +290,7 @@ WIN_InitMouse(_THIS)
mouse->WarpMouse = WIN_WarpMouse;
mouse->SetRelativeMouseMode = WIN_SetRelativeMouseMode;
mouse->CaptureMouse = WIN_CaptureMouse;
mouse->GetAbsoluteMouseState = WIN_GetAbsoluteMouseState;
mouse->GetGlobalMouseState = WIN_GetGlobalMouseState;

SDL_SetDefaultCursor(WIN_CreateDefaultCursor());

Expand Down
4 changes: 2 additions & 2 deletions src/video/x11/SDL_x11mouse.c
Expand Up @@ -354,7 +354,7 @@ X11_CaptureMouse(SDL_Window *window)
}

static Uint32
X11_GetAbsoluteMouseState(int *x, int *y)
X11_GetGlobalMouseState(int *x, int *y)
{
Display *display = GetDisplay();
const int num_screens = SDL_GetNumVideoDisplays();
Expand Down Expand Up @@ -398,7 +398,7 @@ X11_InitMouse(_THIS)
mouse->WarpMouse = X11_WarpMouse;
mouse->SetRelativeMouseMode = X11_SetRelativeMouseMode;
mouse->CaptureMouse = X11_CaptureMouse;
mouse->GetAbsoluteMouseState = X11_GetAbsoluteMouseState;
mouse->GetGlobalMouseState = X11_GetGlobalMouseState;

SDL_SetDefaultCursor(X11_CreateDefaultCursor());
}
Expand Down

0 comments on commit 8436956

Please sign in to comment.