Gtk hack?

In the gtk example, the following bit of code leaves me with a question:

/* Hack to get SDL to use GTK window */
{ char SDL_windowhack[32];
	sprintf(SDL_windowhack,"SDL_WINDOWID=%d",
		GDK_WINDOW_XWINDOW(mainwin->window));
	putenv(SDL_windowhack);
}

I’m just getting started with SDL, but I’m guessing that by stuffing the
X window’s id into the current environment as SDL_WINDOWID lets SDL
figure out which window to draw into-- right?

Now, how does SDL know not to draw all over the window? The example
includes a menubar in that window too-- why does it not get drawn all
over by SDL?

-Roy

Roy Wood wrote:

In the gtk example, the following bit of code leaves me with a question:

    /* Hack to get SDL to use GTK window */
    { char SDL_windowhack[32];
            sprintf(SDL_windowhack,"SDL_WINDOWID=%d",
                    GDK_WINDOW_XWINDOW(mainwin->window));
            putenv(SDL_windowhack);
    }

I’m just getting started with SDL, but I’m guessing that by stuffing the
X window’s id into the current environment as SDL_WINDOWID lets SDL
figure out which window to draw into-- right?

Now, how does SDL know not to draw all over the window? The example
includes a menubar in that window too-- why does it not get drawn all
over by SDL?

SDL does draw all over the window, but the menubar is a separate window,
and GTk takes care of the proper hierarchy and event handling.–
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

In the gtk example, the following bit of code leaves me with a question:

    /* Hack to get SDL to use GTK window */
    { char SDL_windowhack[32];
            sprintf(SDL_windowhack,"SDL_WINDOWID=%d",
                    GDK_WINDOW_XWINDOW(mainwin->window));
            putenv(SDL_windowhack);
    }

I’m just getting started with SDL, but I’m guessing that by stuffing the
X window’s id into the current environment as SDL_WINDOWID lets SDL
figure out which window to draw into-- right?

Now, how does SDL know not to draw all over the window? The example
includes a menubar in that window too-- why does it not get drawn all
over by SDL?

SDL does draw all over the window, but the menubar is a separate window,
and GTk takes care of the proper hierarchy and event handling.

Ah-- so there shouldn’t be any problem just creating a Gtk eventwindow
and using that as the SDL window. True?

-Roy