WinRT: display-information code cleanups
authorDavid Ludwig <dludwig@pobox.com>
Fri, 09 May 2014 21:28:52 -0400
changeset 8757aeeeb47a5a77
parent 8756 d35c6e6ccbb4
child 8758 3b1ed6708ce9
WinRT: display-information code cleanups
src/core/winrt/SDL_winrtapp_direct3d.cpp
src/render/direct3d11/SDL_render_winrt.cpp
src/video/winrt/SDL_winrtpointerinput.cpp
src/video/winrt/SDL_winrtvideo.cpp
     1.1 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp	Fri May 09 20:32:06 2014 -0400
     1.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp	Fri May 09 21:28:52 2014 -0400
     1.3 @@ -170,11 +170,7 @@
     1.4      // for details.  Microsoft's "Display orientation sample" also gives an
     1.5      // outline of how Windows treats device rotation
     1.6      // (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
     1.7 -#if NTDDI_VERSION > NTDDI_WIN8
     1.8 -    DisplayInformation::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
     1.9 -#else
    1.10 -    DisplayProperties::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
    1.11 -#endif
    1.12 +    WINRT_DISPLAY_PROPERTY(AutoRotationPreferences) = (DisplayOrientations) orientationFlags;
    1.13  }
    1.14  
    1.15  static void
     2.1 --- a/src/render/direct3d11/SDL_render_winrt.cpp	Fri May 09 20:32:06 2014 -0400
     2.2 +++ b/src/render/direct3d11/SDL_render_winrt.cpp	Fri May 09 21:28:52 2014 -0400
     2.3 @@ -23,6 +23,7 @@
     2.4  #if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
     2.5  
     2.6  #include "SDL_syswm.h"
     2.7 +#include "../../video/winrt/SDL_winrtvideo_cpp.h"
     2.8  extern "C" {
     2.9  #include "../SDL_sysrender.h"
    2.10  }
    2.11 @@ -79,11 +80,7 @@
    2.12  extern "C" DXGI_MODE_ROTATION
    2.13  D3D11_GetCurrentRotation()
    2.14  {
    2.15 -#if NTDDI_VERSION > NTDDI_WIN8
    2.16 -    const DisplayOrientations currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
    2.17 -#else
    2.18 -    const DisplayOrientations currentOrientation = DisplayProperties::CurrentOrientation;
    2.19 -#endif
    2.20 +    const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
    2.21  
    2.22      switch (currentOrientation) {
    2.23  
     3.1 --- a/src/video/winrt/SDL_winrtpointerinput.cpp	Fri May 09 20:32:06 2014 -0400
     3.2 +++ b/src/video/winrt/SDL_winrtpointerinput.cpp	Fri May 09 21:28:52 2014 -0400
     3.3 @@ -87,7 +87,7 @@
     3.4      outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
     3.5      outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height;
     3.6  #else
     3.7 -    switch (DisplayProperties::CurrentOrientation)
     3.8 +    switch (WINRT_DISPLAY_PROPERTY(CurrentOrientation))
     3.9      {
    3.10          case DisplayOrientations::Portrait:
    3.11              outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
     4.1 --- a/src/video/winrt/SDL_winrtvideo.cpp	Fri May 09 20:32:06 2014 -0400
     4.2 +++ b/src/video/winrt/SDL_winrtvideo.cpp	Fri May 09 21:28:52 2014 -0400
     4.3 @@ -185,11 +185,7 @@
     4.4  
     4.5      // Calculate the display size given the window size, taking into account
     4.6      // the current display's DPI:
     4.7 -#if NTDDI_VERSION > NTDDI_WIN8
     4.8 -    const float currentDPI = DisplayInformation::GetForCurrentView()->LogicalDpi;
     4.9 -#else
    4.10 -    const float currentDPI = Windows::Graphics::Display::DisplayProperties::LogicalDpi;
    4.11 -#endif
    4.12 +    const float currentDPI = WINRT_DISPLAY_PROPERTY(LogicalDpi);
    4.13      const float dipsPerInch = 96.0f;
    4.14      const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
    4.15      const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
    4.16 @@ -211,11 +207,7 @@
    4.17      mode->w = w;
    4.18      mode->h = h;
    4.19      mode->driverdata = driverdata;
    4.20 -#if NTDDI_VERSION > NTDDI_WIN8
    4.21 -    driverdata->currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
    4.22 -#else
    4.23 -    driverdata->currentOrientation = DisplayProperties::CurrentOrientation;
    4.24 -#endif
    4.25 +    driverdata->currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
    4.26  
    4.27  #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
    4.28      // On Windows Phone 8.0, the native window's size is always in portrait,