Re: GTK+ Patch



On Feb 2, 2008 7:31 AM, Denis Oliver Kropp <dok directfb org> wrote:
> Mike Emmel wrote:
> > It would be nice to tie the GdkWindows to Surfaces/SubSurfaces and move the
> > DirectFB windows to be a sort of annotation. This would probably open
> > up implementing
> > embedding. And make the port more versatile.  The toplevels would then
> > happen to have a window but it would be nice if its not required.
> >
> > Next we could take more control over event dispatching and do the hit
> > detection at the surface level.
>
> It's already peeking buffers if you set DWOP_SHAPED :)
>

Right I think this is the right way to do it to decouple from the Window.
We really don't need to be tied tightly to the window interface.
If we happen to have a window then we need to make a few calls to it.

And if we decouple we can do the correct nesting and it gives us a way
to do cross app embedding
at the surface level.

Also of course if we do it right it makes Gtk usable to implement
directfb window managers.


> >> I'm almost through with a rewrite of the event handling, staying as
> >> close as possible to the X11 backend, e.g. don't queue more than
> >> one event (actually transfer/translete from system to local queue)
> >> everytime _gdk_events_queue() is called. First have it processed and
> >> don't block the mainloop too long at once.
> >>
> > One thing is we could use the file descriptor interface and at the fd
> > to be watched by
> > the gdk main loop. This would be better I think ?
>
> I already changed the code to do exactly the same as the X11 backend
> where possible, to ensure maximum compatibility.
>
> Once I finished the rewrite of the remaining event code and everything
> works as before plus working crossing events, I'm committing or send
> another patch.
>
> First I wanted to match the X11 behaviour in every aspect, especially
> to the order and magnitude of events being processed per call etc. I
> also removed the old io source code and replaced by exactly the same
> mechanisms of the X11 backend. The fd is our "connection number" :)
>
> One difference is that GdkDirectFB uses read() instead of XNextEvent().
>
> void
> _gdk_events_queue (GdkDisplay *display)
> {
>    int               ret;
>    GList            *node;
>    GdkEvent         *event;
>    DFBEvent          dfbevent;
>    GdkDisplayDFB    *display_dfb    = GDK_DISPLAY_DFB (display);
>    GdkDisplaySource *display_source = (GdkDisplaySource*) display_dfb->event_source;
>
>    /*
>     * GDK X11 does not process all events here, just until one got into the local queue.
>     */
>
>    while (!_gdk_event_queue_find_first (display) && gdk_check_dfb_pending (display_source))
>      {
>        /* Read ONE event from the DirectFB queue. */
>        ret = read (display_dfb->event_fd, &dfbevent, sizeof(dfbevent));
>

Did we set io not blocking cant remember ?

>
> Checking for pending events is done via XPending() in the X11 backend,
> but buffer->HasEvent() is not supported once the file descriptor mode
> has been activated. Right now I'm just checking "revents", but that's
> not enough to say there's no new event. If there's no GLib Call for this
> I need to do one poll() with immediate return or use non-blocking read()
> which would be easier.
>

A poll is the only way I know to check without reading.
But you should set the io non blocking in any case.
I'll look at  it some after you check it in.


> static gboolean
> gdk_check_dfb_pending (GdkDisplaySource *display_source)
> {
>    D_DEBUG_AT( GDKDFB_EventCheck, "%s( %p )\n", __FUNCTION__, display_source );
>
>    g_return_val_if_fail( display_source != NULL, FALSE );
>
>    D_DEBUG_AT( GDKDFB_EventCheck, "  -> 0x%02x\n", display_source->event_poll_fd.revents );
>
>    return (display_source->event_poll_fd.revents & G_IO_IN) != 0;
> }
>
> At the time of this call, there could be dozens of new events, but this
> will return false, until a complete main loop iteration has taken place.
>

Ahh right.. so that why your saying a non blocking read above.
I'll have a look at the whole thing once its in.

I think the above should be a poll ?

> --
>
> Best regards,
>    Denis Oliver Kropp
>
> .------------------------------------------.
> | DirectFB - Hardware accelerated graphics |
> | http://www.directfb.org/                 |
> "------------------------------------------"
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]