Convert the coordinates in drop events as well (thanks @Dragon-Baroque!)

main
Sam Lantinga 2024-01-16 12:00:36 -08:00
parent e6c8872fdc
commit be0ba78c56
1 changed files with 8 additions and 0 deletions

View File

@ -2490,6 +2490,14 @@ int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event
}
SDL_RenderCoordinatesFromWindow(renderer, event->tfinger.x * w, event->tfinger.y * h, &event->tfinger.x, &event->tfinger.y);
}
} else if (event->type == SDL_EVENT_DROP_POSITION ||
event->type == SDL_EVENT_DROP_FILE ||
event->type == SDL_EVENT_DROP_TEXT ||
event->type == SDL_EVENT_DROP_COMPLETE) {
SDL_Window *window = SDL_GetWindowFromID(event->drop.windowID);
if (window == renderer->window) {
SDL_RenderCoordinatesFromWindow(renderer, event->drop.x, event->drop.y, &event->wheel.x, &event->wheel.y);
}
}
return 0;
}