Hello,
I have been working on creating an SDL/GTK widget. My story will probably
sound familiar as I have seen a few similar posts on the SDL and GTK
lists.
The widget mostly works and is nearly a beautiful thing, but things fall
apart around the expose event handler. Based on debugging output and
calls to sleep(), it looks like: The SDL widget catches and handles the
expose event and correctly updates its surface, but then Gtk clears the
exposed area to the background color (grey). The Gtk documentation
mentions that ``GDK automatically clears the exposed area to the
background color before sending the expose event.’’ Its as though SDL is
beating Gtk to the finish line.
Things I have tried:
-
In an earlier post to this list, Sam suggests a solution: ``I ran into
this with the Qt demo. Basically Gtk fires off a draw event on it’s X
connection, and then SDL fires off it’s draw event. SDL’s completes
first because the GTk drawing is defered to the next event loop update.
What I did was call XSync(display, FALSE) in the Qt app before drawing
with SDL.’’ I have tried calling XSync from within the expose handler
as well as from within an expose wrapper. -
Another common suggestion is to implement the SDL widget as a composite
widget based on GtkDrawingArea OR just create a GtkDrawingArea and give
SDL the drawing area X-window ID. Neither solution has worked for me.
The results are the same: my SDL code does its thing correctly in the
expose handler and then Gtk apparently clears the exposed area to the
background color.
I am beginning to feel like I am flogging a dead horse, but I would really
like to use GTK + SDL to build my tools. Based on the confident
list-replies to earlier queries of this nature, it sounds like there are
others who have working GTK/SDL implementations. I would appreciate any
advice, hints, comments, etc.
Thank you!
shawn