WinRT: display-information code cleanups
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index d17171b..fc5909a 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -170,11 +170,7 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n
// for details. Microsoft's "Display orientation sample" also gives an
// outline of how Windows treats device rotation
// (http://code.msdn.microsoft.com/Display-Orientation-Sample-19a58e93).
-#if NTDDI_VERSION > NTDDI_WIN8
- DisplayInformation::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
-#else
- DisplayProperties::AutoRotationPreferences = (DisplayOrientations) orientationFlags;
-#endif
+ WINRT_DISPLAY_PROPERTY(AutoRotationPreferences) = (DisplayOrientations) orientationFlags;
}
static void
diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp
index 9ed67fd..19c060f 100644
--- a/src/render/direct3d11/SDL_render_winrt.cpp
+++ b/src/render/direct3d11/SDL_render_winrt.cpp
@@ -23,6 +23,7 @@
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
#include "SDL_syswm.h"
+#include "../../video/winrt/SDL_winrtvideo_cpp.h"
extern "C" {
#include "../SDL_sysrender.h"
}
@@ -79,11 +80,7 @@ D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
extern "C" DXGI_MODE_ROTATION
D3D11_GetCurrentRotation()
{
-#if NTDDI_VERSION > NTDDI_WIN8
- const DisplayOrientations currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
-#else
- const DisplayOrientations currentOrientation = DisplayProperties::CurrentOrientation;
-#endif
+ const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
switch (currentOrientation) {
diff --git a/src/video/winrt/SDL_winrtpointerinput.cpp b/src/video/winrt/SDL_winrtpointerinput.cpp
index 5900413..a2f7e4b 100644
--- a/src/video/winrt/SDL_winrtpointerinput.cpp
+++ b/src/video/winrt/SDL_winrtpointerinput.cpp
@@ -87,7 +87,7 @@ WINRT_TransformCursorPosition(SDL_Window * window,
outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height;
#else
- switch (DisplayProperties::CurrentOrientation)
+ switch (WINRT_DISPLAY_PROPERTY(CurrentOrientation))
{
case DisplayOrientations::Portrait:
outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width;
diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp
index 0443b99..6ec0160 100644
--- a/src/video/winrt/SDL_winrtvideo.cpp
+++ b/src/video/winrt/SDL_winrtvideo.cpp
@@ -185,11 +185,7 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
// Calculate the display size given the window size, taking into account
// the current display's DPI:
-#if NTDDI_VERSION > NTDDI_WIN8
- const float currentDPI = DisplayInformation::GetForCurrentView()->LogicalDpi;
-#else
- const float currentDPI = Windows::Graphics::Display::DisplayProperties::LogicalDpi;
-#endif
+ const float currentDPI = WINRT_DISPLAY_PROPERTY(LogicalDpi);
const float dipsPerInch = 96.0f;
const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
@@ -211,11 +207,7 @@ WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
mode->w = w;
mode->h = h;
mode->driverdata = driverdata;
-#if NTDDI_VERSION > NTDDI_WIN8
- driverdata->currentOrientation = DisplayInformation::GetForCurrentView()->CurrentOrientation;
-#else
- driverdata->currentOrientation = DisplayProperties::CurrentOrientation;
-#endif
+ driverdata->currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);
#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
// On Windows Phone 8.0, the native window's size is always in portrait,