Use a valid finger ID when generating touch events from mouse events

Fixes https://github.com/libsdl-org/SDL/issues/9185
main
Sam Lantinga 2024-03-03 09:15:07 -08:00
parent c6ec999869
commit 107e06a92a
1 changed files with 2 additions and 2 deletions

View File

@ -571,7 +571,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
if (window) {
float normalized_x = x / (float)window->w;
float normalized_y = y / (float)window->h;
SDL_SendTouchMotion(timestamp, SDL_MOUSE_TOUCHID, 0, window, normalized_x, normalized_y, 1.0f);
SDL_SendTouchMotion(timestamp, SDL_MOUSE_TOUCHID, SDL_BUTTON_LEFT, window, normalized_x, normalized_y, 1.0f);
}
}
}
@ -754,7 +754,7 @@ static int SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_
if (window) {
float normalized_x = mouse->x / (float)window->w;
float normalized_y = mouse->y / (float)window->h;
SDL_SendTouch(timestamp, SDL_MOUSE_TOUCHID, 0, window, track_mouse_down, normalized_x, normalized_y, 1.0f);
SDL_SendTouch(timestamp, SDL_MOUSE_TOUCHID, SDL_BUTTON_LEFT, window, track_mouse_down, normalized_x, normalized_y, 1.0f);
}
}
}