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 1166 - No mouse motion events while SDL_SetRelativeMouseMode() is active
Summary: No mouse motion events while SDL_SetRelativeMouseMode() is active
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86 Mac OS X 10.6
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-09 16:27 UTC by Vern Jensen
Modified: 2011-03-11 16:04 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 Vern Jensen 2011-03-09 16:27:37 UTC
When I call SDL_SetRelativeMouseMode( true ) I get no mouse motion events until disabling relative mouse mode. For me, this defeats the very purpose of having relative mouse mode -- to get mouse motion events without the cursor actually being moved.

OS X 10.6.6

SDL-1.3.0-5445
Comment 1 Sam Lantinga 2011-03-09 16:35:01 UTC
You get no mouse motion events, or you get no motion?
When you set relative mouse mode you should be still getting motion events, but only the relative fields of the mouse motion will be changing.
Comment 2 Vern Jensen 2011-03-09 16:40:42 UTC
I am getting no events, period.

		case SDL_MOUSEMOTION:
		
				printf("Mouse moved by %d,%d to (%d,%d) in windowID %d\n", 
					event->motion.xrel, event->motion.yrel,
					event->motion.x, event->motion.y, event->motion.windowID);
		break;

I get a nice stream of events printed to the XCode console prior to calling SDL_SetRelativeMouseMode(). As soon as I set it to true, I get no events printed to the window while moving the mouse.
Comment 3 Sam Lantinga 2011-03-09 16:57:59 UTC
Interesting. If I run testsprite2 with --info event and use Ctrl-R to toggle relative mode, I still see a string of mouse motion events.  Are you seeing that as well?
Comment 4 Vern Jensen 2011-03-09 19:44:48 UTC
Sorry for asking something that should probably be obvious, but how do I run it with --info event?

 I just hit "Build and Run" and don't know where to enter settings like that.
Comment 5 Vern Jensen 2011-03-09 19:56:28 UTC
Okay, well for the time being I manually enabled event reporting in the code, and discovered what the problem is. Yes, I do get events when relative mode is enabled, but NOT if the mouse button is down.

I DO get mouse-moved events normally, even if the mouse button is down.

You see, in my game, I have a map screen that the user can drag around with the mouse. They click to drag it. Therefore, the mouse button is down the entire time they are dragging the map. I'm wanting to enable relative mode when the mouse button is clicked, and disable it when the button is released. But currently, pushing the mouse button disables all mouse-moved events if relative mode is on.

So I'm seeing the same thing you're seeing. You just weren't pushing the mouse button. :-)
Comment 6 Sam Lantinga 2011-03-09 21:22:40 UTC
Ah, okay, thanks!
Comment 7 Sam Lantinga 2011-03-11 16:04:03 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/50cd1fb880e5