Fullscreen woes

With recent SDL-libs games like Heroes III screw up my X when running
in fullscreen. First of all it start in the lowest position. Secondly,
when exiting, F1 (normally bound to lower) doesn’t do anything, F2
(normally bound to raise) lowers and other weirdness. Running xev
fixed the problem!

Anyway, looking in the code, this snippet from SDL_x11modes.c is the
problem:

    if ( XQueryTree(SDL_Display, SDL_Root, &tmpwin, &tmpwin,
                            &windows, &nwindows) && windows ) {
        /* If not, try to put us there - if fail... oh well */
        if ( windows[nwindows-1] != FSwindow ) {
            tmpwin = windows[nwindows-1];
            for ( i=0; i<nwindows; ++i ) {
                if ( windows[i] == FSwindow ) {
                    memcpy(&windows[i], &windows[i+1],
                           (nwindows-i-1)*sizeof(windows[i]));
                    break;
                }
            }
            windows[nwindows-1] = FSwindow;
            XRestackWindows(SDL_Display, windows, nwindows);
            XSync(SDL_Display, False);
        }
        XFree(windows);
    }

I don’t see the point of this code. First of all, it obviously breaks
a number of displays and when omitted everything works perfectly. If
we need to raise the window here (which might be a good idea), why not
use XRaiseWindow instead? The following line:

XRaiseWindow(SDL_Display, FSwindow);

should do exactly the same (raise the window to the top) and it
doesn’t screw up WindowMaker or rearrange my windows (with the
original code, windows other than the SDL window gets lowered/raised -
very annoying).

I have attached a patch that fixes the code.–
[ Below is a random fortune, which is unrelated to the above message. ]
There’s a whole WORLD in a mud puddle!
– Doug Clifford
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl-patch
Type: text/x-patch
Size: 1401 bytes
Desc: Change XRestackWindows code to a simple XRaiseWindow.
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20000311/bed74163/attachment.bin

With recent SDL-libs games like Heroes III screw up my X when running
in fullscreen.

This should be fixed in the latest CVS snapshot.
Please let me know if it isn’t.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec