sdl2-compat icon indicating copy to clipboard operation
sdl2-compat copied to clipboard

Use SDL3's integer mouse mode hint

Open cgutman opened this issue 8 months ago • 5 comments

This reverts https://github.com/libsdl-org/sdl2-compat/pull/378 and uses the new SDL3 integer mouse mode hint from https://github.com/libsdl-org/SDL/pull/12497 (further modified in https://github.com/libsdl-org/SDL/pull/12551) instead.

I also searched GitHub for popular SDL2 apps that support fractional wheel events and preemptively quirked them so they will continue to receive them. Unquirked apps will just receive wheel events when they accumulate to an integer value (preserving compatibility but losing smooth scrolling). We can quirk others if users report loss of smooth scrolling with sdl2-compat.

Fixes #372

cgutman avatar Mar 09 '25 03:03 cgutman

We should wait to merge this until we get closer to the next SDL3 release.

slouken avatar Mar 09 '25 04:03 slouken

This will need to require 3.2.10 at runtime (when it's released)

sezero avatar Mar 09 '25 04:03 sezero

This will need to require 3.2.10 at runtime (when it's released)

Yep, I'll take care of this when I merge it.

slouken avatar Mar 09 '25 15:03 slouken

heads-up: https://github.com/libsdl-org/SDL/commit/f52f982b1e9ce2f510f2c26c6119e79dbb5b20a0 slightly changes the behavior of the mode values to behave as a bitflag instead.

expikr avatar Mar 22 '25 16:03 expikr

Thanks, updated the PR for that change.

cgutman avatar Mar 23 '25 21:03 cgutman

OpenTTD relies on both fractional values (for smooth two-finger viewport dragging) and accumulated integer values (for scrolling in menus). Should it be quirked?

v1993 avatar Apr 01 '25 15:04 v1993

OpenTTD relies on both fractional values (for smooth two-finger viewport dragging) and accumulated integer values (for scrolling in menus). Should it be quirked?

Yes, feel free to submit a tested PR.

slouken avatar Apr 01 '25 16:04 slouken

@slouken I've tried it and can't get both accumulated integer and precise fractional scrolling to work at the same time (default is jumpy 2-finger dragging, SDL_MOUSE_INTEGER_MODE=1 breaks menu scrolling on touchpad). Is it possible to accurately emulate old behavior where accumulation was done for integer but not precise values?

v1993 avatar Apr 08 '25 00:04 v1993