[1.3 iOS] Window surface not valid after SDL_WINDOWEVENT

Hi all,

I’m using SDL 1.3 with a software blitter in various systems and I’m having a weird problem in iOS: the main window surface stops being valid after I get the SDL_WINDOWEVENT_RESTORED event.

In short, after I set up the screen I store the window surface (as returned by SDL_GetWindowSurface) for software blitting and everything works fine. However, when I do something like displaying and then hiding the notification bar in iOS 5, the window surface stop being valid. The program doesn’t crash and I can still blit to the old surface, it looks like the old surface is not being blit by SDL to the screen anymore and it doesn’t represent the window contents anymore.

The problem also appears in iOS 4 and I can workaround it as whenever this issue happens the SDL_WINDOWEVENT_RESTORED event is also triggered, so I can just do
Code:
SDL_FreeSurface(surface);
surface = SDL_GetWindowSurface(mainwindow);

I’m writing here before filing a bug report in case I’m missing something but it certainly looks like a bug to me.

Thanks for your time,
Joseba

Out of curiosity, does it work if you switch from the software renderer to
the opengles2 renderer?On Tue, Dec 27, 2011 at 1:03 PM, josebagar <joseba.gar at gmail.com> wrote:

**
Hi all,

I’m using SDL 1.3 with a software blitter in various systems and I’m
having a weird problem in iOS: the main window surface stops being valid
after I get the SDL_WINDOWEVENT_RESTORED event.

In short, after I set up the screen I store the window surface (as
returned by SDL_GetWindowSurface) for software blitting and everything
works fine. However, when I do something like displaying and then hiding
the notification bar in iOS 5, the window surface stop being valid. The
program doesn’t crash and I can still blit to the old surface, it looks
like the old surface is not being blit by SDL to the screen anymore and it
doesn’t represent the window contents anymore.

The problem also appears in iOS 4 and I can workaround it as whenever this
issue happens the SDL_WINDOWEVENT_RESTORED event is also triggered, so I
can just do

Code:

SDL_FreeSurface(surface);
surface = SDL_GetWindowSurface(mainwindow);

I’m writing here before filing a bug report in case I’m missing something
but it certainly looks like a bug to me.

Thanks for your time,
Joseba


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Excuse me, I didn’t explain myself correctly: the game engine renders the screen by software and then writes the result to an SDL_Surface, then tells SDL to blit that SDL_Surface to the main window.
I don’t call SDL_CreateRenderer manually but instead let SDL do that for me.

Can you post a simple example that shows the problem?

Thanks!On Wed, Dec 28, 2011 at 10:59 AM, josebagar <joseba.gar at gmail.com> wrote:

**
Excuse me, I didn’t explain myself correctly: the game engine renders the
screen by software and then writes the result to an SDL_Surface, then tells
SDL to blit that SDL_Surface to the main window.
I don’t call SDL_CreateRenderer manually but instead let SDL do that for
me.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’ve been trying to follow the process that happens when such an event is triggered and it looks like when sending the SDL_WINDOWEVENT_RESTORED event, SDL calls SDL_OnWindowRestored(), which in turn calls SDL_UpdateFullscreenMode() and there’s probably where SDL calls for the resolution change (if for some reason it determines that it needs to be called). I’ll try to look at what data the function has with the Xcode debugger, then.

If I don’t find a cause in my code, I’ll try to create and post a simple example as soon as I come back in a few days, as I’m out of home right now (Christmas).