WinRT: display-information code cleanups
parent
d4f1d2257e
commit
164e5b89d5
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue