[Cogl] [PATCH] Rework sdl integration api
Robert Bragg
robert at sixbynine.org
Thu Apr 12 04:21:30 PDT 2012
On Thu, Apr 12, 2012 at 12:05 PM, Neil Roberts <neil at linux.intel.com> wrote:
> On Wed, 11 Apr 2012 22:07:18 +0100, Robert Bragg <robert at sixbynine.org> wrote:
>
>> int status = SDL_PollEvent (&event);
>> if (!status && data.redraw_queued)
>> break;
>> else if (!status)
>> {
>> cogl_sdl_idle (ctx);
>> if (!SDL_WaitEvent (&event))
>> {
>> fprintf (stderr, "Error waiting for SDL events");
>> return 1;
>> }
>> }
>
> Just a minor nitpick, couldn't those two if-statements be simplified
> like this equivalent code:
>
> if (!SDL_PollEvent (&event))
> {
> if (data.redraw_queued)
> break;
>
> cogl_sdl_idle (ctx);
> if (!SDL_WaitEvent (&event))
> {
> fprintf (stderr, "Error waiting for SDL events");
> return 1;
> }
> }
ah, yup, oops.
>
> Otherwise the patch looks good to me.
>
> Reviewed-by: Neil Roberts <neil at linux.intel.com>
>
>> Out of curiosity, I wonder if you think this setup would work on the
>> Palm Pre which I recall you saying has some funky interactions between
>> SDL and glib?
>
> I think it won't work because Palm's implementation of SDL internally
> uses GLib with the default context in a separate thread. That means if
> you try to use the GLib main loop the dispatch functions end up running
> in a secret thread internal to WebOS. My solution before was to run a
> sed script over the symbols exported by glib and change the soname so
> that the application ends up linking against two distinct glib libraries
> so that they can have their own independent default context. This is a
> bit nuts though.
ok, well I suppose it would still be kinda nice that we can make the
GSource api work with SDL on most platforms and the Palm Pre will just
have to be a special case where developers have to use the cogl_sdl_
api instead if they dont want to be running sed over libraries :-)
regards,
- Robert
>
> Regards,
> - Neil
More information about the Cogl
mailing list