url: WinRT actually works now (and has been tested, hooray!).

This commit is contained in:
Ryan C. Gordon 2020-10-06 00:42:17 -04:00
parent fc05a696ad
commit 4627426994
2 changed files with 17 additions and 3 deletions

View file

@ -438,6 +438,9 @@
<ClInclude Include="..\..\src\events\SDL_displayevents_c.h"> <ClInclude Include="..\..\src\events\SDL_displayevents_c.h">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\include\SDL_misc.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\atomic\SDL_atomic.c"> <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
@ -791,5 +794,11 @@
<ClCompile Include="..\..\src\events\SDL_displayevents.c"> <ClCompile Include="..\..\src\events\SDL_displayevents.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\misc\winrt\SDL_sysurl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\misc\SDL_url.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -21,17 +21,22 @@
#include <Windows.h> #include <Windows.h>
#include "../../core/windows/SDL_windows.h"
#include "../SDL_sysurl.h" #include "../SDL_sysurl.h"
int int
SDL_SYS_OpenURL(const char *url) SDL_SYS_OpenURL(const char *url)
{ {
Platform::String^ strurl = url; WCHAR *wurl = WIN_UTF8ToString(url);
if (!wurl) {
return SDL_OutOfMemory();
}
auto strurl = ref new Platform::String(wurl);
SDL_free(wurl); SDL_free(wurl);
auto uri = ref new Windows::Foundation::Uri(strurl); auto uri = ref new Windows::Foundation::Uri(strurl);
launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri)); Windows::System::Launcher::LaunchUriAsync(uri);
return 0; return 0; // oh well, we're not waiting on an async task here.
} }
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */