We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 680

Summary: Maximize Button/SDL_RESIZABLE Flag
Product: SDL Reporter: Jonathan Greig <redteam316>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: redteam316
Version: 1.2.13Keywords: target-1.2.14
Hardware: x86   
OS: Linux   

Description Jonathan Greig 2009-01-16 16:07:40 UTC
I tested, and apparently to be able to use the maximize button, you must pass the SDL_RESIZABLE flag to the video mode on THE VERY FIRST TIME IT IS INITIALIZED OR ELSE IT WONT WORK.

My code was setting:

    /* Create a 640x480 OpenGL screen */
    if ( SDL_SetVideoMode(640, 480, 0, SDL_OPENGL) == NULL ) {
        fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError());
        SDL_Quit();
        exit(2);
    }

on the very first initialization. And I was hitting SDLK_p to actually change the video mode with this code in an SDL_Event while loop:

                      case SDLK_p:
                          /* Create a 800x600 OpenGL screen */
                          if ( SDL_SetVideoMode(800, 600, 0, SDL_RESIZABLE | SDL_OPENGL) == NULL ) {
                              fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError());
                              SDL_Quit();
                              exit(2);
                          }

                          /* Set the title bar in environments that support it */
                          SDL_WM_SetCaption("CAD VIEWER TEST", NULL);

                          /* Loop, drawing and checking events */
                          InitGL(800, 600);
                      break;

I am using SDL 1.2.13 on Kubuntu 8.04 "Hardy Heron" and that it where I reproduced this from. I haven't tested on Windows at this point but I would think it occurs there too.
Comment 1 Ryan C. Gordon 2009-09-13 16:33:34 UTC
Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14.

Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla).

--ryan.
Comment 2 Sam Lantinga 2009-09-21 04:01:04 UTC
Yes, this is the expected behavior.  You can't change the resize hints on a window in X11 once it's been shown and registered with the window manager.
Comment 3 Ryan C. Gordon 2009-09-21 05:32:40 UTC
(We should probably tear down the window and rebuild it for this sort of case in SDL 1.3.)

As a workaround for 1.2, if you need to add/remove SDL_RESIZABLE, you can probably call SDL_Quit() then SDL_Init() before SDL_SetVideoMode() to "fix" this.

--ryan.