Re: GTK+ Patch
- From: Denis Oliver Kropp <dok directfb org>
- To: Mike Emmel <mike emmel gmail com>
- Cc: gtk-devel-list <gtk-devel-list gnome org>, Sven Neumann <sven gimp org>
- Subject: Re: GTK+ Patch
- Date: Sat, 02 Feb 2008 16:31:52 +0100
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 :)
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));
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.
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.
--
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]