Skip to content

AutoGrab changes

mazmazz requested to merge mazmazz_/SRB2:sdl-autograb-revise into sdl-autograb
  • Move SDL_SetWindowGrab() to code block where -nomouse is checked false. This makes sure that the cursor doesn't get grabbed at all under -nomouse.
  • Set wrapmouseok to be consistent with SDLdoUngrabMouse()
  • Toggle cursor visibility

The caveat to this merge's logic is that, if cv_usemouse.value is OFF without -nomouse, then the mouse will be repositioned on program start, even though it's not grabbed.

I can't think of a way around this -- the way that CV_CALL works, I can't move this behavior behind the cvar call. First, cv_usemouse initializes to ON. Second, CV_CALL is not being called twice if the cvar value is not changed. I.e., it's called when init'ed to ON upon cvar registration, but NOT called when set to the same ON value upon user config load.

I think it's a worthy tradeoff, though, to allow those who do use the mouse to auto-grab on start.

Merge request reports