[SailfishDevel] Question creating full screen SDL window

Thomas Perl th.perl at gmail.com
Sat Apr 5 08:51:21 UTC 2014


On 04 Apr 2014, at 18:57, Iosif Hamlatzis <i.hamlatzis at gmail.com> wrote:
> I have different behaviour creating a full screen SDL window between Sailfish OS and other mobile platforms I have tested.
> 
> I am using the same source code below:
> 
> SDL_Window* pWindow = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_OPENGL|SDL_WINDOW_FULLSCREEN|SDL_WINDOW_SHOWN);
> 
> int ActualScreenWidth_ = -1;
> int ActualScreenHeight_ = -1;
> 
> SDL_GetWindowSize(pWindow, &ActualScreenWidth_, &ActualScreenHeight_);
> 
> In all cases including Sailfish OS I get the correct width and height of the device, but (yes there is a but) on Sailfish OS nothing is drawn on screen when I later try to render an image. I have tested this on the emulator and on the actual device. Also I have tested this not only with my code but also with code I've found at https://github.com/thp/sdl2-opengles-test
> 
> If I modify my code to:
> SDL_Window* pWindow = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_OPENGL|SDL_WINDOW_FULLSCREEN|SDL_WINDOW_SHOWN);
> 
> int ActualScreenWidth_ = -1;
> int ActualScreenHeight_ = -1;
> 
> SDL_GetWindowSize(pWindow, &ActualScreenWidth_, &ActualScreenHeight_);
> SDL_DestroyWindow(pWindow);
> 
> pWindow = SDL_CreateWindow("",0, 0,ActualScreenWidth_, ActualScreenHeight_,
>                            SDL_WINDOW_OPENGL|SDL_WINDOW_FULLSCREEN|SDL_WINDOW_SHOWN);
> 
> Which I think is strange since in the first place the pWindow I get from the first call is valid and the values I get from querying the window size correspond to the device's resolution.

That actually sounds like a bug in the SDL Wayland code (basically the special values 0 for width and height should be interpreted as “fullscreen size” if SDL_WINDOW_FULLSCREEN is passed in, that’s not done at the moment for the Wayland backend, it uses the values you pass in to create the EGL surface, and because that surface is 0x0, nothing gets drawn on the screen):

https://hg.libsdl.org/SDL/file/default/src/video/wayland/SDL_waylandwindow.c

I’ll look into it. For now, you sadly have to resort to the workaround you describe (basically “probing” the window size and then requesting it).


Thanks,
Thomas


More information about the Devel mailing list