SDL: When mouse is ungrabbed (menu, ...) the view is jumping

Issue #9 resolved
Daniel Gibson created an issue

when returning from a menu, one often looks into a totally different direction than before. This can even be reproduced by just ungrabbing the mouse with CTRL-G

Comments (3)

  1. Daniel Gibson reporter

    SDL: Prevent mouse from jumping when ungrabbing (fix #9)

    .. by just discarding the first relative mouse movement value from SDL_GetRelativeMouseState() if we just lost grab. I think the problem is that when ungrabbing the mouse (or probably when re-setting absolute mouse mode) SDL gets other coordinates than before and thus reports a big mouse movement when there was none.

    → <<cset 5d20716e9d45>>

  2. Daniel Gibson reporter

    Yeah, 15 minutes after reporting the bug or so it became obvious to me why my previous fixing attempts had failed (I already had the justLostGrab idea, but I forgot that I have to call SDL_GetRelativeMouseState() anyway to discard the bad values..)

  3. Daniel Gibson reporter

    SDL: Prevent mouse from jumping when ungrabbing (fix #9)

    .. by just discarding the first relative mouse movement value from SDL_GetRelativeMouseState() if we just lost grab. I think the problem is that when ungrabbing the mouse (or probably when re-setting absolute mouse mode) SDL gets other coordinates than before and thus reports a big mouse movement when there was none.

    → <<cset a8ba4e38db94>>

  4. Log in to comment