Moved iOS-specific code into uikit target. Fixes crashes in X11 target.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 12 Sep 2012 19:36:18 -0400
changeset 6419 b75e82af5ef1
parent 6418 9c12f2c8057b
child 6420 6f52dc57f05e
Moved iOS-specific code into uikit target. Fixes crashes in X11 target.
src/video/SDL_video.c
src/video/uikit/SDL_uikitvideo.m
src/video/uikit/SDL_uikitwindow.h
src/video/uikit/SDL_uikitwindow.m
--- a/src/video/SDL_video.c	Mon Sep 10 20:25:55 2012 -0700
+++ b/src/video/SDL_video.c	Wed Sep 12 19:36:18 2012 -0400
@@ -1890,13 +1890,6 @@
     if (FULLSCREEN_VISIBLE(window)) {
         SDL_UpdateFullscreenMode(window, SDL_TRUE);
     }
-
-    /* This needs to be done on iOS to rebind the nscontext to the view,
-       and (hopefully) doesn't hurt on other systems.
-    */
-    if (window == _this->current_glwin) {
-        _this->GL_MakeCurrent(_this, _this->current_glwin, _this->current_glctx);
-    }
 }
 
 void
--- a/src/video/uikit/SDL_uikitvideo.m	Mon Sep 10 20:25:55 2012 -0700
+++ b/src/video/uikit/SDL_uikitvideo.m	Wed Sep 12 19:36:18 2012 -0400
@@ -85,6 +85,7 @@
     device->CreateWindow = UIKit_CreateWindow;
     device->ShowWindow = UIKit_ShowWindow;
     device->HideWindow = UIKit_HideWindow;
+    device->RaiseWindow = UIKit_RaiseWindow;
     device->SetWindowFullscreen = UIKit_SetWindowFullscreen;
     device->DestroyWindow = UIKit_DestroyWindow;
     device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
--- a/src/video/uikit/SDL_uikitwindow.h	Mon Sep 10 20:25:55 2012 -0700
+++ b/src/video/uikit/SDL_uikitwindow.h	Wed Sep 12 19:36:18 2012 -0400
@@ -31,6 +31,7 @@
 extern int UIKit_CreateWindow(_THIS, SDL_Window * window);
 extern void UIKit_ShowWindow(_THIS, SDL_Window * window);
 extern void UIKit_HideWindow(_THIS, SDL_Window * window);
+extern void UIKit_RaiseWindow(_THIS, SDL_Window * window);
 extern void UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
 extern void UIKit_DestroyWindow(_THIS, SDL_Window * window);
 extern SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window,
--- a/src/video/uikit/SDL_uikitwindow.m	Mon Sep 10 20:25:55 2012 -0700
+++ b/src/video/uikit/SDL_uikitwindow.m	Wed Sep 12 19:36:18 2012 -0400
@@ -226,6 +226,16 @@
 }
 
 void
+UIKit_RaiseWindow(_THIS, SDL_Window * window)
+{
+    // We don't currently offer a concept of "raising" the SDL window, since
+    //  we only allow one per display, in the iOS fashion.
+    // However, we use this entry point to rebind the context to the view
+    //  during OnWindowRestored processing.
+    _this->GL_MakeCurrent(_this, _this->current_glwin, _this->current_glctx);
+}
+
+void
 UIKit_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
 {
     SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;