| Summary: | No mouse motion events while SDL_SetRelativeMouseMode() is active | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Vern Jensen <vern> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X 10.6 | ||
|
Description
Vern Jensen
2011-03-09 16:27:37 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. 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.
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? 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. 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. :-) Ah, okay, thanks! Fixed, thanks! http://hg.libsdl.org/SDL/rev/50cd1fb880e5 |