Added SDL_DROPTEXT event, for dragging and dropping string data.

This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.

--HG--
extra : histedit_source : e662a1d2d2a9bba6a75c799d9f7228303d654de1
This commit is contained in:
Ryan C. Gordon 2016-01-05 02:26:45 -05:00
parent 6a3cfbf68f
commit b8b82c170e
5 changed files with 38 additions and 38 deletions

View file

@ -77,9 +77,10 @@ main(int argc, char *argv[])
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
if (event.type == SDL_DROPFILE) {
if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) {
const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text";
char *dropped_filedir = event.drop.file;
SDL_Log("File dropped on window: %s", dropped_filedir);
SDL_Log("%s dropped on window: %s", typestr, dropped_filedir);
SDL_free(dropped_filedir);
}
}