Jean-François Sévère | 1 Apr 2012 11:23
Picon

window not going quite fullscreen

Hi everyone !
I seem to have a bug with my current window class. I'm trying to create a window given a WindowConfguration struct. It should try to create a SDL window, but if the video mode is not supported, it will default to windowed mode of requested size.
I'm having problems on ubuntu 10.10 LTS. When I give a valid video mode, the desktop resolution changes, but the window decoration and gnome bars still show. I still have expected fullscreen behaviour, the desktop resolution changes back when I alt tab, and back again when I go back to my SDL window. But I'm not quite fullscreen.

here's my code so far

void WindowSDL::create(WindowConfiguration p_configuration)
{
    //No need to create if we already have a window
    if(m_window) return;
   
    //Is the screen correct ? if not, use default screen
    if(p_configuration.screen>=getNumScreens()) p_configuration.screen=0;
   
    //Pre-set some opengl attributes
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, p_configuration.depthBuffer);
   
    unsigned flags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
    if(p_configuration.fullscreen)
    {
        //Check video mode
        SDL_DisplayMode mode, modematch;
        mode.format = SDL_PIXELFORMAT_UNKNOWN;
        mode.w = p_configuration.mode.width;
        mode.h = p_configuration.mode.height;
        mode.refresh_rate = p_configuration.mode.refreshRate;
        ///Find a video mode that matches params, or stay windowed
        if(SDL_GetClosestDisplayMode(p_configuration.screen, &mode, &modematch))
        {
            //Set fullscreen flag
            flags |=SDL_WINDOW_FULLSCREEN;
            p_configuration.mode.width = modematch.w;
            p_configuration.mode.height = modematch.h;
            p_configuration.mode.refreshRate = modematch.refresh_rate;
        }
        else p_configuration.fullscreen=false;
    }
   
    //We have what we need, let's create the window
    m_window = SDL_CreateWindow ("Entropy Engine",
        SDL_WINDOWPOS_UNDEFINED_DISPLAY(p_configuration.screen), SDL_WINDOWPOS_UNDEFINED_DISPLAY(p_configuration.screen),
        p_configuration.mode.width, p_configuration.mode.height, flags );
   
    ///No window : fail
    if(m_window == NULL)
    {
        std::cout << "Failed to create window" << std::endl;
        return;
    }

    //Add an opengl context
    m_context = SDL_GL_CreateContext(m_window);
    //Vsync
    SDL_GL_SetSwapInterval(p_configuration.vsync);
    //Glew
    glewInit();
    m_windows[m_window] = this;
    m_running=true;
}

I've confirmed that the "flags |=SDL_WINDOW_FULLSCREEN;" part is executed, so I did find a matching mode.
I'm running SDL HG head.
Is there anything I'm doing wrong ?

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

Gmane