Message: 21
Relative mousemove events don’t work correctly on OS X if:
- You have the input grabbed w/ the cursor hidden and
- you are fullscreen.
It seems that it’s just not grabbing the cursor at all, so when you hit
the edge of the window, the relative motion is 0. This is expected
behaviour for when the cursor is showing, but not when it’s hidden.
Windowed mode works correctly with the hidden cursor/grabbed input
combination.
Quickest example is to use SDL12/test/threadwin and add a
SDL_WM_GrabInput(SDL_GRAB_ON) right before the SetVideoMode call. In
windowed mode, the cursor sits in the middle of the window (hmmm,
that’s
not right, either…) and relative motion events are correct. Run it
with
the -fullscreen option, and it doesn’t grab the cursor. Calling
SDL_ShowCursor(0) doesn’t change the relative motion behaviour.
So in windowed mode, the mouse is grabbed a little too much, and in
fullscreen, not quite enough.
Yeah, the cursor isn’t grabbed at all in fullscreen mode. When I wrote
the code I was trying for the minimal implementation of “Mouse is
constrained to SDL window”. In fullscreen mode, I don’t do a real grab
because I don’t have to (based on the definition I was working with).
In windowed mode, the cursor is frozen in the center of the screen
(essentially, the cursor has been detached from the mouse). But it’s
grabbed “too much” in that the hardware cursor is frozen and basically
useless.
Seriously, the fullscreen thing makes it hard to do FPS games, since
you
can’t spin all the way around with the mouse.
Would you be in favor of a full grab in fullscreen mode as well? This
will fix your FPS issue, and it’s a quick fix. It doesn’t fix the “too
much” problem though.
Maybe “just right” would warp the cursor to the opposite side of the
window/screen when it went over the edge. How do other platforms
constrain the mouse to the window (X11, Win32)?
Darrell, can I get your expert touch on this one if I promise to stop
nagging you about the mouse after this?
It’s no bother (yet), so feel free to keep nagging. The mouse movement
code has had lots of bugs/quirks since the beginning and I don’t expect
that to end anytime soon ;-)On Tuesday, December 17, 2002, at 03:01 PM, sdl-request at libsdl.org wrote:
Date: Tue, 17 Dec 2002 02:54:49 -0500 (EST)
From: “Ryan C. Gordon”
To:
Subject: [SDL] Another OS X mouse issue…
Reply-To: sdl at libsdl.org