diff -r edacce9402fb src/video/windows/SDL_windowsevents.c --- a/src/video/windows/SDL_windowsevents.c Sun Sep 30 01:08:48 2012 -0700 +++ b/src/video/windows/SDL_windowsevents.c Sun Sep 30 14:43:13 2012 +0200 @@ -29,6 +29,10 @@ #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" +/* Dropfile support */ +#include + + /*#define WMMSG_DEBUG*/ @@ -619,7 +623,29 @@ return 0; } break; - } + + case WM_DROPFILES: + { + UINT i; + HDROP drop = (HDROP) wParam; + UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); + for (i = 0; i < count; ++i) { + UINT size = DragQueryFile(drop, i, NULL, 0) + 1; + LPTSTR buffer = SDL_stack_alloc(TCHAR, size); + if (buffer) { + if (DragQueryFile(drop, i, buffer, size)) { + char *file = WIN_StringToUTF8(buffer); + SDL_SendDropFile(file); + SDL_free(file); + } + SDL_stack_free(buffer); + } + } + DragFinish(drop); + return 0; + } + break; + } /* If there's a window proc, assume it's going to handle messages */ if (data->wndproc) { diff -r edacce9402fb src/video/windows/SDL_windowswindow.c --- a/src/video/windows/SDL_windowswindow.c Sun Sep 30 01:08:48 2012 -0700 +++ b/src/video/windows/SDL_windowswindow.c Sun Sep 30 14:43:13 2012 +0200 @@ -29,6 +29,9 @@ #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" +/* Dropfile support */ +#include + /* This is included after SDL_windowsvideo.h, which includes windows.h */ #include "SDL_syswm.h" @@ -185,6 +188,9 @@ videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH|TWF_WANTPALM)); } + /* Enable dropping files */ + DragAcceptFiles(hwnd, TRUE); + /* All done! */ return 0; }