Re: GTK / SDL bis
- From: Iain Holmes <iain ximian com>
- To: raphi2 raph <raphi2 caramail com>
- Cc: gtk-list gnome org, otaylor redhat com
- Subject: Re: GTK / SDL bis
- Date: Fri, 22 Jun 2001 16:18:00 -0400 (EDT)
> In fact I would like to "include" a little SDL window in a
> big GTK window. (by example to be able to play movies in my
> GTK application)
Okay, you can do it with the hack below, but you have to do the putenv
hack *before* you call SDL_Init.
Also from what I understood about SDL you can only have one window per
process, at least only one window embedded in a GTK window as the putenv
hack is global.
I dunno if it's possible with threads to get more than one SDL window into
a GTK one, but it's possibly the ugliest hack I've seen yet. Plus when you
start trying to do this stuff with bonobo controls, then you have fun
about waiting for windows to be realised before calling sdlinit.
iain
>
>
>
> I tried to resolve my problem with your advices :) but I
> have still problems. here is the part of my program with
> problems:
>
>
> SDL_Thread *thread;
> GtkWidget *drawing_area;
> Window xwin;
>
> gtk_sess *sess = (gtk_sess *)data;
>
> sess->new = gtk_window_new(GTK_WINDOW_TOPLEVEL);
> gtk_widget_set_usize(sess->new, 460, 500);
> // gtk_widget_show (sess->new);
>
> sess->fixed = gtk_fixed_new();
> gtk_widget_ref (sess->fixed);
> gtk_widget_show (sess->fixed);
> gtk_container_add(GTK_CONTAINER(sess->new), sess->fixed);
>
> drawing_area = gtk_drawing_area_new();
> gtk_widget_set_usize(drawing_area, 100, 100);
> gtk_fixed_put(GTK_FIXED(sess->fixed), drawing_area, 400,
> 400);
> gtk_widget_realize(drawing_area);
> gtk_widget_show(drawing_area);
>
>
> { char SDL_windowhack[32];
> sprintf(SDL_windowhack,"SDL_WINDOWID=-543170384",
> GDK_WINDOW_XWINDOW(drawing_area->window));
> putenv(SDL_windowhack);
> }
>
> screen = SDL_SetVideoMode(100, 100, 0, 0);
> thread = SDL_CreateThread(play_film, sess);
> if (thread == NULL)
> printf("Probleme avec la thread\n");
> // gtk_timeout_add(5, animation, sess);
>
>
> I do the SDL_Init before this in an init function.
>
> Do you see something wrong in this code ?
>
> Thanks a lot for help
>
> Raph
> _________________________________________________________
> Le journal des abonnés Caramail - http://www.carazine.com
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]