1
1
forked from 0ad/0ad

Prevent double-click when moving the mouse.

SDL 2.0.9 introduced a 32-pixel leeway for double clicks to register,
which makes it possible to trigger "select all units of the same type"
behaviour while trying to select different units that are close by.

This effectively reverts that by setting the "hint" to 1.

Fixes #5920

Differential Revision: https://code.wildfiregames.com/D3420
This was SVN commit r24698.
This commit is contained in:
wraitii 2021-01-19 13:13:00 +00:00
parent 60ac4543c1
commit 876ac2fead

View File

@ -640,6 +640,11 @@ static void InitSDL()
// Text input is active by default, disable it until it is actually needed.
SDL_StopTextInput();
#if SDL_VERSION_ATLEAST(2, 0, 9)
// SDL2 >= 2.0.9 defaults to 32 pixels (to support touch screens) but that can break our double-clicking.
SDL_SetHint(SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS, "1");
#endif
#if OS_MACOSX
// Some Mac mice only have one button, so they can't right-click
// but SDL2 can emulate that with Ctrl+Click