| | |
| | | /* |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | consumed = -1; |
| | | } |
| | | if (consumed < 0) { |
| | | SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); |
| | | SDLTest_CommonLogUsage(state, argv[0], NULL); |
| | | quit(1); |
| | | } |
| | | i += consumed; |
| | |
| | | while (!done) { |
| | | /* Check for events */ |
| | | while (SDL_PollEvent(&event)) { |
| | | SDLTest_CommonEvent(state, &event, &done); |
| | | |
| | | if (event.type == SDL_DROPBEGIN) { |
| | | SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID); |
| | | } else if (event.type == SDL_DROPCOMPLETE) { |
| | |
| | | const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text"; |
| | | char *dropped_filedir = event.drop.file; |
| | | SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir); |
| | | SDL_free(dropped_filedir); |
| | | /* Normally you'd have to do this, but this is freed in SDLTest_CommonEvent() */ |
| | | /*SDL_free(dropped_filedir);*/ |
| | | } |
| | | |
| | | SDLTest_CommonEvent(state, &event, &done); |
| | | } |
| | | } |
| | | |