upgrade SDL to version 2.0.8
[platform/upstream/SDL.git] / test / testdropfile.c
index 0b010d3..e078c08 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright (C) 1997-2018 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
@@ -25,7 +25,7 @@ quit(int rc)
     exit(rc);
 }
 int
-SDL_main(int argc, char *argv[])
+main(int argc, char *argv[])
 {
     int i, done;
     SDL_Event event;
@@ -51,7 +51,7 @@ SDL_main(int argc, char *argv[])
             consumed = -1;
         }
         if (consumed < 0) {
-            SDLTest_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
+            SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
             quit(1);
         }
         i += consumed;
@@ -76,9 +76,14 @@ SDL_main(int argc, char *argv[])
         while (SDL_PollEvent(&event)) {
             SDLTest_CommonEvent(state, &event, &done);
 
-            if (event.type == SDL_DROPFILE) {
+            if (event.type == SDL_DROPBEGIN) {
+                SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID);
+            } else if (event.type == SDL_DROPCOMPLETE) {
+                SDL_Log("Drop complete on window %u", (unsigned int) event.drop.windowID);
+            } else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) {
+                const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text";
                 char *dropped_filedir = event.drop.file;
-                SDLTest_Log("File dropped on window: %s", dropped_filedir);
+                SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir);
                 SDL_free(dropped_filedir);
             }
         }