Hi,

On Wed, 2009-08-12 at 13:12 +0200, Carsten Behling wrote:
> I currently try to understand the directfb GDK backend code for event
> handling.
> 
> Can anybody tell me why the dfb_events_io_func is used to call
> dfb_events_dispatch ?
> 
> In the win32 backend and the old linux-fb backend there is the
> dispatch
> function registered as follws:
> 
> static GSourceFuncs xxx_events_funcs = {
>   xxx_events_prepare,
>   xxx_events_check,
>   xxx_events_dispatch,
>   NULL
> };
> 
> ...
> 
> void 
> _gdk_events_init (void)
> {
>   GSource *source;
> 
>   source = g_source_new (&xxx_events_funcs, sizeof (GSource));
>   ...
>   g_source_attach (source, NULL);
> }
> 
> ...
> 
> Why using the detour with g_io_channel_unix_new(...) ?

Because it is much simpler to use a GIOChannel than to implement all
GSourceFuncs. And it boils down to the same functionality.

> BTW, is the dfb_events_io_func correctly attached with
> g_source_set_callback(..) in _gdk_events_init(..) ?
> Should we use g_io_add_watch(...) instead ?

The code looks correct to me. One could also use g_io_add_watch() here.
The difference is that the current code sets 

  g_source_set_can_recurse (source, TRUE);

which would not be called by g_io_add_watch(). I am not sure if this is
done intentionally. But I don't think it should be changed unless there
is a good reason.


Sven


_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to