From c8e397c32f99fb837a4979e87a8cbcadcb013e59 Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Wed, 3 Dec 2014 10:55:23 -0500 Subject: [PATCH] WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this! --- src/core/winrt/SDL_winrtapp_direct3d.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp index d91451068..009d1a52c 100644 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -126,6 +126,16 @@ static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *n { SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0); + /* HACK: prevent SDL from altering an app's .appxmanifest-set orientation + * from being changed on startup, by detecting when SDL_HINT_ORIENTATIONS + * is getting registered. + * + * TODO, WinRT: consider reading in an app's .appxmanifest file, and apply its orientation when 'newValue == NULL'. + */ + if ((oldValue == NULL) && (newValue == NULL)) { + return; + } + // Start with no orientation flags, then add each in as they're parsed // from newValue. unsigned int orientationFlags = 0;