use SDL2 Drop Event when available
Signed-off-by: Thomas Bernard <miniupnp@free.fr>
This commit is contained in:
parent
82ef08a01e
commit
0843bd6a3c
18
src/input.c
18
src/input.c
@ -1039,6 +1039,24 @@ int Get_input(int sleep_time)
|
||||
#endif
|
||||
// End of Joystick handling
|
||||
|
||||
#if defined(USE_SDL2)
|
||||
case SDL_DROPFILE:
|
||||
GFX2_Log(GFX2_DEBUG, "SDL_DROPFILE: %s\n", event.drop.file);
|
||||
Drop_file_name = strdup(event.drop.file);
|
||||
SDL_free(event.drop.file);
|
||||
break;
|
||||
case SDL_DROPTEXT:
|
||||
GFX2_Log(GFX2_DEBUG, "SDL_DROPTEXT: \"%s\"\n", event.drop.file);
|
||||
SDL_free(event.drop.file);
|
||||
break;
|
||||
case SDL_DROPBEGIN:
|
||||
GFX2_Log(GFX2_DEBUG, "SDL_DROPBEGIN\n");
|
||||
break;
|
||||
case SDL_DROPCOMPLETE:
|
||||
GFX2_Log(GFX2_DEBUG, "SDL_DROPCOMPLETE\n");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case SDL_SYSWMEVENT:
|
||||
#ifdef __WIN32__
|
||||
if(event.syswm.msg->msg == WM_DROPFILES)
|
||||
|
||||
@ -538,13 +538,19 @@ HWND GFX2_Get_Window_Handle(void)
|
||||
/// Activates or desactivates file drag-dropping in program window.
|
||||
void Allow_drag_and_drop(int flag)
|
||||
{
|
||||
#if defined(USE_SDL2)
|
||||
// SDL 2.x
|
||||
SDL_EventState(SDL_DROPFILE, flag ? SDL_ENABLE : SDL_DISABLE);
|
||||
#else
|
||||
// SDL 1.x
|
||||
// Inform Windows that we accept drag-n-drop events or not
|
||||
#ifdef __WIN32__
|
||||
#ifdef __WIN32__
|
||||
DragAcceptFiles(GFX2_Get_Window_Handle(), flag?TRUE:FALSE);
|
||||
SDL_EventState (SDL_SYSWMEVENT,flag?SDL_ENABLE:SDL_DISABLE );
|
||||
#else
|
||||
(void)flag; // unused
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Set application icon(s)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user