From 4916f55cea7984774c0c18129308758ccdb6e220 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 12 Sep 2012 19:36:18 -0400 Subject: [PATCH] Moved iOS-specific code into uikit target. Fixes crashes in X11 target. --- src/video/SDL_video.c | 7 ------- src/video/uikit/SDL_uikitvideo.m | 1 + src/video/uikit/SDL_uikitwindow.h | 1 + src/video/uikit/SDL_uikitwindow.m | 10 ++++++++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 2c3486694..312de245d 100755 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1890,13 +1890,6 @@ SDL_OnWindowRestored(SDL_Window * window) 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 diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 9c724d7c8..d1bf9d938 100755 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -85,6 +85,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) 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; diff --git a/src/video/uikit/SDL_uikitwindow.h b/src/video/uikit/SDL_uikitwindow.h index 9635aa9fa..925443453 100755 --- a/src/video/uikit/SDL_uikitwindow.h +++ b/src/video/uikit/SDL_uikitwindow.h @@ -31,6 +31,7 @@ typedef struct SDL_WindowData SDL_WindowData; 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, diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index ba92d0d85..2ff36ed38 100755 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -225,6 +225,16 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo uiwindow.hidden = YES; } +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) {