|
@@ -18,6 +18,9 @@
|
|
|
misrepresented as being the original software.
|
|
misrepresented as being the original software.
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
*/
|
|
*/
|
|
|
|
|
+
|
|
|
|
|
+// Modified by Lasse Oorni for Urho3D
|
|
|
|
|
+
|
|
|
#include "../../SDL_internal.h"
|
|
#include "../../SDL_internal.h"
|
|
|
|
|
|
|
|
#if SDL_VIDEO_DRIVER_UIKIT
|
|
#if SDL_VIDEO_DRIVER_UIKIT
|
|
@@ -41,10 +44,23 @@
|
|
|
|
|
|
|
|
#include <Foundation/Foundation.h>
|
|
#include <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
|
|
+// Urho3D: iOS 8 window size hack based on work of Alex Szpakowski
|
|
|
|
|
+// https://bitbucket.org/slime73/sdl-experiments
|
|
|
|
|
+@implementation SDL_uikitwindow
|
|
|
|
|
|
|
|
|
|
+- (void)layoutSubviews
|
|
|
|
|
+{
|
|
|
|
|
+ [super layoutSubviews];
|
|
|
|
|
|
|
|
|
|
+ // Forcibly set window frame based on screen bounds, which follow the orientation on iOS 8
|
|
|
|
|
+ if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) {
|
|
|
|
|
+ self.frame = self.screen.bounds;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+@end
|
|
|
|
|
|
|
|
-static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created)
|
|
|
|
|
|
|
+// Urho3D: use subclass for iOS 8 window size hack
|
|
|
|
|
+static int SetupWindowData(_THIS, SDL_Window *window, SDL_uikitwindow *uiwindow, SDL_bool created)
|
|
|
{
|
|
{
|
|
|
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
|
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
|
|
|
SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata;
|
|
SDL_DisplayModeData *displaymodedata = (SDL_DisplayModeData *) display->current_mode.driverdata;
|
|
@@ -193,7 +209,8 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
|
|
|
|
|
|
|
|
/* ignore the size user requested, and make a fullscreen window */
|
|
/* ignore the size user requested, and make a fullscreen window */
|
|
|
/* !!! FIXME: can we have a smaller view? */
|
|
/* !!! FIXME: can we have a smaller view? */
|
|
|
- UIWindow *uiwindow = [UIWindow alloc];
|
|
|
|
|
|
|
+ // Urho3D: create subclass for iOS 8 window size hack
|
|
|
|
|
+ SDL_uikitwindow *uiwindow = [SDL_uikitwindow alloc];
|
|
|
uiwindow = [uiwindow initWithFrame:[data->uiscreen bounds]];
|
|
uiwindow = [uiwindow initWithFrame:[data->uiscreen bounds]];
|
|
|
|
|
|
|
|
/* put the window on an external display if appropriate. This implicitly
|
|
/* put the window on an external display if appropriate. This implicitly
|