diff --git a/src/FNAPlatform/SDL2_FNAPlatform.cs b/src/FNAPlatform/SDL2_FNAPlatform.cs index d1e9423a..91b6c5d3 100644 --- a/src/FNAPlatform/SDL2_FNAPlatform.cs +++ b/src/FNAPlatform/SDL2_FNAPlatform.cs @@ -36,6 +36,8 @@ internal static class SDL2_FNAPlatform private static bool SupportsGlobalMouse; + private static bool SupportsOrientations; + #endregion #region Game Objects @@ -236,6 +238,10 @@ public static string ProgramInit(LaunchParameters args) OSVersion.Equals("Mac OS X") || videoDriver.Equals("x11") ); + // Only iOS and Android care about device orientation. + SupportsOrientations = ( OSVersion.Equals("iOS") || + OSVersion.Equals("Android") ); + /* High-DPI is really annoying and only some platforms * actually let you control the drawable surface. */ @@ -915,7 +921,7 @@ FNAWindow window public static bool SupportsOrientationChanges() { - return OSVersion.Equals("iOS") || OSVersion.Equals("Android"); + return SupportsOrientations; } #endregion @@ -1166,16 +1172,19 @@ ref bool textInputSuppress // Orientation Change if (evt.display.displayEvent == SDL.SDL_DisplayEventID.SDL_DISPLAYEVENT_ORIENTATION) { - DisplayOrientation orientation = INTERNAL_ConvertOrientation( - (SDL.SDL_DisplayOrientation) evt.display.data1 - ); + if (SupportsOrientationChanges()) + { + DisplayOrientation orientation = INTERNAL_ConvertOrientation( + (SDL.SDL_DisplayOrientation) evt.display.data1 + ); - INTERNAL_HandleOrientationChange( - orientation, - game.GraphicsDevice, - currentAdapter, - (FNAWindow) game.Window - ); + INTERNAL_HandleOrientationChange( + orientation, + game.GraphicsDevice, + currentAdapter, + (FNAWindow) game.Window + ); + } } else {