I’ve been developing a SDL app that works within a GTK window. The
application consists of a single GTK window with a menu. I use SDL to draw
in the window. I can successfully use the SDL/GTK window id environment
variable to get SDL to draw in the window.
The window is relatively large so I choose to draw the whole window
initially and then only update a subsection of it for performance reasons. I
capture the window expose event to redraw the whole screen as required.
However when I access the window menu and then leave the menu it leaves a
gray box where the menu was. Similarly when the window is partially covered
by another and I bring the GTK/SDL window back to the foreground I can see
it being redrawn by SDL then GTK over the top.(It leaves a gray area)
I can see the GTK event being raised which I then redraw the screen then the
gray box appears afterwards. After doing some investigation I think this is
because GTK fires off the event then does its own redrawing after the signal
handler has completed. Looking at the GTK documentation they recommend using
a GTK Drawing Area Widget which GTK will do no drawing. (More info:
I modified my application to use a GTK Drawing Area Widget over the main
window but then none of the SDL drawing shows through (maybe GTK is drawing
it then drawing the GtkDrawingArea over the top of it?)
I have tried changing the exported window id to that of the Drawable area
but that has caused the program to exit when attempting to call
SDL_SetVideoMode() with a BadWindow error.
Any ideas on the how to do this would be greatly appreciated.
Add photos to your e-mail with MSN 8. Get 2 months FREE*.