[OLPC-Games] GTK+ video target for SDL, first attempt.
Ryan C. Gordon
icculus at icculus.org
Tue May 15 18:15:57 EDT 2007
> Tell me everything you know; I'll be starting work in this area in a few
> days.
- Get the source from Subversion:
svn co http://svn.libsdl.org/branches/SDL-1.2-olpc
- Build it with GTK+ support:
./autogen.sh
./configure --enable-video-gtk
make && sudo make install
- export SDL_VIDEODRIVER=gtk
- Run SDL apps. :) The best bet is to go through everything in the
test directory:
cd SDL-1.2-olpc/test
./configure
make
./testalpha
The code in question is in SDL-1.2-olpc/src/video/gtk ... it's fairly
straightforward, since I started from the "dummy" driver which is mostly
empty. 9/10ths of the work is going through the code in src/video/x11
and making the GTK target functionally equivalent...mostly that's a
matter of finding the GDK equivalent of a given Xlib call, and trimming
X11 cruft for various extensions and buggy X servers, etc.
There is a lot of functionality that's missing right now. Here's my
probably-incomplete list:
- No mousegrab support (probably not necessary with Sugar).
- No fullscreen support (not sure how this pans out in Sugar).
- No ability to change fullscreen resolutions (again, not needed in Sugar?)
- No palette support at the moment (may not be an issue, I think this is
just for actual 8-bit visuals, not the shadow surface, which SDL can
convert when blitting to the screen.)
- Keyboard input needs to be hooked up. This will need a lookup table
and the appropriate GTK+ signals wired up, where it gets converted
through the lookup table and pushed into the SDL event queue. Writing
this will be a little tedious, but probably not difficult.
- There are a bunch of FIXME comments where I'm not sure about how
refcounting is handled in GTK for various APIs...you can probably clean
these up with a little research, otherwise we are likely leaking a few
bytes of memory here and there.
- We're using _gdk_windowing_get_bits_for_depth(), which is not a public
GDK entry point...this will probably cease working if GTK+ is ever
rebuilt with GCC's -fvisibility=hidden, so a better solution is needed here.
- The background color property of the window probably needs to be set
to black by default (compare x11 and gtk target with
SDL-1.2-olpc/test/testoverlay.c).
- These patches should be applied:
Remove polling from SDL_WaitEvent() (this will need further patches
to the GTK video target):
http://bugzilla.libsdl.org/show_bug.cgi?id=323
Remove extra memset from audio callback (saves CPU cycles, not
required):
http://bugzilla.libsdl.org/show_bug.cgi?id=416
Things like joysticks and audio output and threads and such should Just
Work as-is on the laptops, really this is strictly about gluing SDL to GTK+.
If you make progress, I'll get you write access to the Subversion repo.
Patches committed to Subversion email me a copy of the patch, and since
it's on a branch, I don't care what you break, so you can commit without
going through me first and I'll comment if I see an issue.
And, of course, if you have any questions, don't hesitate to ask. If I
do any work on it, I'll let you know, too, so we don't step on each
other's toes.
Thanks,
--ryan.
More information about the Games
mailing list