mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-01 23:07:45 +08:00
Return the touch device name for SDL_TOUCH_MOUSEID
This commit is contained in:
@@ -428,7 +428,17 @@ const char *SDL_GetMouseNameForID(SDL_MouseID instance_id)
|
|||||||
name = "Mouse";
|
name = "Mouse";
|
||||||
break;
|
break;
|
||||||
case SDL_TOUCH_MOUSEID:
|
case SDL_TOUCH_MOUSEID:
|
||||||
|
// We can't tell which touch device it was, just use the first one
|
||||||
|
{
|
||||||
|
SDL_TouchID *devices = SDL_GetTouchDevices(NULL);
|
||||||
|
if (devices) {
|
||||||
|
name = SDL_GetTouchDeviceName(devices[0]);
|
||||||
|
SDL_free(devices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!name) {
|
||||||
name = "Touch";
|
name = "Touch";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_PEN_MOUSEID:
|
case SDL_PEN_MOUSEID:
|
||||||
name = "Pen";
|
name = "Pen";
|
||||||
|
|||||||
Reference in New Issue
Block a user