The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Android: Window surface is invalid after suspend
Reto Schneider
Guest

Hi

I built testgesture.c for Android and installed it successfully:

./androidbuild.sh org.libsdl.testgesture ../test/testgesture.c
cd ../build/org.libsdl.testgesture/
ant debug install

The testgesture application works as intended, but when I put my
devices[1] in sleep mode and awake them after, the application can no
longer update the screen (whatever has been on the screen before is
still there). The rest of the application however still works (events
come in and get proceeded). Changing the device from landscape to
portrait mode fixes the problem.

I noticed that the return value of SDL_UpdateWindowSurface()[2] in
DrawScreen() is -1 after a resume and the output of SDL_GetError() is
the following:

Window surface is invalid, please call SDL_GetWindowSurface() to get
a new surface

Calling SDL_GetWindowSurface() indeed allows the screen to "come back"
to life. However, I do not think that this is a good fix for this problem.

Any recommendation?

Regards,
Reto

1: Nexus 5/Android 4.4.2, Archos 80 G9/Android 4.0.4, HTC
Explorer/Android 2.3.5
2: https://hg.libsdl.org/SDL/file/abf45e1abfe3/test/testgesture.c#l187
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Android: Window surface is invalid after suspend
Reto Schneider
Guest

Hi

I built testgesture.c for Android and installed it successfully:

./androidbuild.sh org.libsdl.testgesture ../test/testgesture.c
cd ../build/org.libsdl.testgesture/
ant debug install

The testgesture application works as intended, but when I put my
devices[1] in sleep mode and awake them after, the application can no
longer update the screen (whatever has been on the screen before is
still there). The rest of the application however still works (events
come in and get proceeded). Changing the device from landscape to
portrait mode fixes the problem.

I noticed that the return value of SDL_UpdateWindowSurface()[2] in
DrawScreen() is -1 after a resume and the output of SDL_GetError() is
the following:

Window surface is invalid, please call SDL_GetWindowSurface() to get
a new surface

Calling SDL_GetWindowSurface() indeed allows the screen to "come back"
to life. However, I do not think that this is a good fix for this problem.

Any recommendation?

Regards,
Reto

1: Nexus 5/Android 4.4.2, Archos 80 G9/Android 4.0.4, HTC
Explorer/Android 2.3.5
2: https://hg.libsdl.org/SDL/file/abf45e1abfe3/test/testgesture.c#l187
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org