WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.1 apps
authorDavid Ludwig
Sun, 06 Dec 2015 18:33:43 -0500
changeset 99506cc7e0682758
parent 9949 67cc0111da82
child 9951 839a45509496
WinRT: enabled the Win10-Store Cert Kit bug-workaround, for Windows 8.1 apps
src/video/winrt/SDL_winrtvideo.cpp
     1.1 --- a/src/video/winrt/SDL_winrtvideo.cpp	Sun Dec 06 17:32:33 2015 -0500
     1.2 +++ b/src/video/winrt/SDL_winrtvideo.cpp	Sun Dec 06 18:33:43 2015 -0500
     1.3 @@ -330,11 +330,12 @@
     1.4                 happens, and use a hackish means to create a reasonable-as-possible
     1.5                 'display mode'.  -- DavidL
     1.6              */
     1.7 -#if (NTDDI_VERSION >= NTDDI_WIN10) && SDL_WINRT_USE_APPLICATIONVIEW
     1.8 +#if SDL_WINRT_USE_APPLICATIONVIEW
     1.9              if (adapterIndex == 0 && outputIndex == 0) {
    1.10                  SDL_VideoDisplay display;
    1.11                  SDL_DisplayMode mode;
    1.12                  ApplicationView ^ appView = ApplicationView::GetForCurrentView();
    1.13 +                CoreWindow ^ coreWin = CoreWindow::GetForCurrentThread();
    1.14                  SDL_zero(display);
    1.15                  SDL_zero(mode);
    1.16                  display.name = "DXGI Display-detection Workaround";
    1.17 @@ -343,10 +344,19 @@
    1.18                     give a better approximation of display-size, than did CoreWindow's
    1.19                     Bounds property, insofar that ApplicationView::VisibleBounds seems like
    1.20                     it will, at least some of the time, give the full display size (during the
    1.21 -                   failing test), whereas CoreWindow will not.  -- DavidL
    1.22 +                   failing test), whereas CoreWindow might not.  -- DavidL
    1.23                  */
    1.24 +
    1.25 +#if (NTDDI_VERSION >= NTDDI_WIN10) || (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
    1.26                  mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width);
    1.27                  mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height);
    1.28 +#else
    1.29 +                /* On platform(s) that do not support VisibleBounds, such as Windows 8.1,
    1.30 +                   fall back to CoreWindow's Bounds property.
    1.31 +                */
    1.32 +                mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Width);
    1.33 +                mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Height);
    1.34 +#endif
    1.35  
    1.36                  mode.format = DXGI_FORMAT_B8G8R8A8_UNORM;
    1.37                  mode.refresh_rate = 0;  /* Display mode is unknown, so just fill in zero, as specified by SDL's header files */
    1.38 @@ -358,7 +368,7 @@
    1.39                      return SDL_SetError("Failed to apply DXGI Display-detection workaround");
    1.40                  }
    1.41              }
    1.42 -#endif  // (NTDDI_VERSION >= NTDDI_WIN10) && SDL_WINRT_USE_APPLICATIONVIEW
    1.43 +#endif  // SDL_WINRT_USE_APPLICATIONVIEW
    1.44  
    1.45              break;
    1.46          }