We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 758 - inconsistancy in API between 1.2 and 1.3 for SDL_GetMouseState
Summary: inconsistancy in API between 1.2 and 1.3 for SDL_GetMouseState
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: All All
: P1 critical
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL: http://www.libsdl.org/cgi/docwiki.cgi...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-26 22:25 UTC by Ken Bull
Modified: 2009-12-16 11:51 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Bull 2009-06-26 22:25:30 UTC
SDL_GetMouseState in 1.2 looks like this:
Uint8 SDL_GetMouseState (int* x, int* y);

SDL_GetMouseState in 1.3 looks like this:
Uint8 SDL_GetMouseState (int index, int* x, int* y);

SDL_GetMouseState in 1.3 should look like this:
Uint8 SDL_GetMouseState (int* x, int* y);

and work like this:
SDL_SelectMouse (index);
button = SDL_GetMouseState (&x, &y);
Comment 1 Ryan C. Gordon 2009-06-28 20:57:21 UTC
I'm not sure we should do a "SelectMouse" API, but we probably shouldn't change the signature of functions that were in 1.2...perhaps a different function name for the new version, and SDL_GetMouseState() will be equivalent to SDL_NewVersionOfGetMouseState(0,x,y), or something.

This is the approach I took in adding multiple audio devices to 1.3 ... the 1.2 functions, which can't address a specific piece of hardware, assume the most reasonable default device.

Are there other function signatures we've changed like this? I assume this specific one was a GSoC 2008 change.

--ryan.
Comment 2 Ken Bull 2009-06-29 13:20:09 UTC
(In reply to comment #1)
> I'm not sure we should do a "SelectMouse" API, but we probably shouldn't change
> the signature of functions that were in 1.2...perhaps a different function name
> for the new version, and SDL_GetMouseState() will be equivalent to
> SDL_NewVersionOfGetMouseState(0,x,y), or something.

There is ALREADY a SDL_SelectMouse function in SDL 1.3.  The doxygen documentation for SDL_GetMouseState in 1.3 even says that it uses the "currently selected mouse".  It just doesn't.  Same thing for SDL_GetRelativeMouseState, SDL_SetRelativeMouseMode, SDL_GetRelativeMouseMod and SDL_GetMouseFocusWindow.

SDL_WarpMouseInWindow, SDL_CreateCursor, SDL_SetCursor, SDL_GetCursor and SDL_ShowCursor are currently the only functions that could ask for an index but don't (though multiple cursors aren't really supported yet, each of these refers to SDL_current_mouse in the code), but they also refer to the "currently selected mouse" in the documentation.

I'd personally recommend SDL_GetMouseState use the device selected with SDL_SelectMouse and have a SDL_GetMouseStateEx (or similar) which takes a mouse index, and do the same for other similar functions.
Comment 3 Ryan C. Gordon 2009-06-29 14:11:28 UTC
> There is ALREADY a SDL_SelectMouse function in SDL 1.3.

Ugh, that should be removed. I'm grabbing this bug, so I can look into this further.

--ryan.
Comment 4 Sam Lantinga 2009-12-14 23:03:46 UTC
Ryan, this needs to be fixed ASAP however we do it, because currently the iPhone demos don't compile.
Comment 5 Ryan C. Gordon 2009-12-15 22:39:08 UTC
Priority bump.

--ryan.
Comment 6 Ryan C. Gordon 2009-12-16 11:51:01 UTC
I cleaned this up. SDL_GetMouseState() is now as it was in 1.2. The SelectMouse stuff is still there, but this is a mess I have to sort through.

But this should get the iPhone demos, and other existing code, up and running again.

This is svn revision #5420.

--ryan.