WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.1 apps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index d7f6cb3..5a91f12 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -330,11 +330,12 @@ WINRT_AddDisplaysForAdapter (_THIS, IDXGIFactory2 * dxgiFactory2, int adapterInd
happens, and use a hackish means to create a reasonable-as-possible
'display mode'. -- DavidL
*/
-#if (NTDDI_VERSION >= NTDDI_WIN10) && SDL_WINRT_USE_APPLICATIONVIEW
+#if SDL_WINRT_USE_APPLICATIONVIEW
if (adapterIndex == 0 && outputIndex == 0) {
SDL_VideoDisplay display;
SDL_DisplayMode mode;
ApplicationView ^ appView = ApplicationView::GetForCurrentView();
+ CoreWindow ^ coreWin = CoreWindow::GetForCurrentThread();
SDL_zero(display);
SDL_zero(mode);
display.name = "DXGI Display-detection Workaround";
@@ -343,10 +344,19 @@ WINRT_AddDisplaysForAdapter (_THIS, IDXGIFactory2 * dxgiFactory2, int adapterInd
give a better approximation of display-size, than did CoreWindow's
Bounds property, insofar that ApplicationView::VisibleBounds seems like
it will, at least some of the time, give the full display size (during the
- failing test), whereas CoreWindow will not. -- DavidL
+ failing test), whereas CoreWindow might not. -- DavidL
*/
+
+#if (NTDDI_VERSION >= NTDDI_WIN10) || (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width);
mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height);
+#else
+ /* On platform(s) that do not support VisibleBounds, such as Windows 8.1,
+ fall back to CoreWindow's Bounds property.
+ */
+ mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Width);
+ mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Height);
+#endif
mode.format = DXGI_FORMAT_B8G8R8A8_UNORM;
mode.refresh_rate = 0; /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */
@@ -358,7 +368,7 @@ WINRT_AddDisplaysForAdapter (_THIS, IDXGIFactory2 * dxgiFactory2, int adapterInd
return SDL_SetError("Failed to apply DXGI Display-detection workaround");
}
}
-#endif // (NTDDI_VERSION >= NTDDI_WIN10) && SDL_WINRT_USE_APPLICATIONVIEW
+#endif // SDL_WINRT_USE_APPLICATIONVIEW
break;
}