In X11 relative mouse events do not hold a reference for the window.
(As per the documentation of X11 “Since raw events do not have target
windows they are delivered exclusively to all root windows.”).
In Win32, they don’t necessarily have to be associated with a window, you
can choose to:
a) only get raw input messages on the window that enabled it when that
window has focus (single window mode)
b) always get raw input messages on the window has focus, regardless of who
initialized it (window with focus mode)
c) always get messages even if minimized and no focus (“input sink” mode).
b) is likely the best answer, even if you set the SDL_event’s window
parameter to NULL.
Once relative mouse motion event is received its send to the event
queue without a window parameter.If someone wants to limit mouse
motion only inside once window its better to grab the mouse
This makes me sound like relative mouse movement allows the cursor to leave
the window and various other issues listed below.
Maybe someone could point to documentation for the desired behavior? My
understanding of this feature is that it:
a) makes the cursor disappear
b) doesn’t allow the cursor to leave the SDL window with focus
c) reports relative mouse movements directly from the hardware (since the
cursor “ceases to exist” as such)
The typical use-case of this would be something like a FPS where you want
mouse look but don’t want the look ability to abruptly halt when it leaves
the window, nor clicks to unfocus your game window (if running in window
mode).
If you don’t enable relative mouse movement, you can still get relative
mouse coordinates since SDL will track the cursor position and compute
deltas, but:
a) the cursor is visible
b) the cursor can leave the application window in window mode
c) if the cursor reaches the edge of the screen, relative movements can’t
happen since they are tracked based on delta cursor position and not
reading the mouse HW.
PatrickOn Thu, Jun 7, 2012 at 3:04 PM, Dimitris Zenios <dimitris.zenios at gmail.com>wrote: