entry: Drop file event for SDL.

This commit is contained in:
Branimir Karadžić 2018-01-03 22:49:10 -08:00
parent d616ed345b
commit 8c91699678
2 changed files with 22 additions and 0 deletions

View File

@ -746,6 +746,10 @@ restart:
break;
case Event::DropFile:
{
const DropFileEvent* drop = static_cast<const DropFileEvent*>(ev);
DBG("%s", drop->m_filePath.get() );
}
break;
default:
@ -904,6 +908,10 @@ restart:
break;
case Event::DropFile:
{
const DropFileEvent* drop = static_cast<const DropFileEvent*>(ev);
DBG("%s", drop->m_filePath.get() );
}
break;
default:

View File

@ -488,6 +488,8 @@ namespace entry
WindowHandle defaultWindow = { 0 };
setWindowSize(defaultWindow, m_width, m_height, true);
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
bx::FileReaderI* reader = NULL;
while (NULL == reader)
{
@ -806,6 +808,18 @@ namespace entry
}
break;
case SDL_DROPFILE:
{
const SDL_DropEvent& dev = event.drop;
WindowHandle handle = defaultWindow; //findHandle(dev.windowID);
if (isValid(handle) )
{
m_eventQueue.postDropFileEvent(handle, dev.file);
SDL_free(dev.file);
}
}
break;
default:
{
const SDL_UserEvent& uev = event.user;