Re: Where to implement motion compression




Robert Minsk <egbert@centropolisfx.com> writes:

> I currently adding motion compression to the event loop in gtk+ and wanted
> some feedback as to what library (gdk or gtk) to implement it.  Motion
> compression filter throws out all but the last motion notify (the most
> recent position).  This is useful for widgets that need the most up-to-date
> position but do not need the full history of pointer positions.  Unlike the
> current MOTION_HINT_MASK this would be done in the event loop avoiding the
> round trip to the X server with gdk_window_get_pointer.  Also events are
> delivered in order (see discussion on gtk-list).
> 
> I currently have implemented it in gtk_main_do_event and have added a
> GtkWidgetFlag called GTK_COMPRESS_MOTION.  This seems like the correct
> place to add it because it is a property of the widget.
> 
> It could be implemented more efficiently in gdk_event_translate and make it
> a property of the window.  I would add GDK_POINTER_MOTION_COMPRESS_MASK to
> GdkEventMask but that does not make since because it is not an event.
> There's the problem.

I like this better. Yes, it is not an event, but it closely
parallels GDK_MOTION_HINT_MASK as a property of how events
are handled for a particular window. (Also, this would give
a natural way of handling compression for pointer grabs
if we wanted to add this later.)

The user doesn't need to know that GDK_MOTION_HINT_MASK is
handled on the server and GDK_MOTION_COMPRESS_MASK is
handled in the client.

The way to implement this then, is to add flag to the private
data structure for GdkWindow that is updated from 
gdk_window_new and gdk_window_set_evnets.

(This code has been considerably restructured in GTK+-1.3 with
the introduction of cross-platform code and a lot of other
enhancements to GDK, so the data structures are no longer
the same but the basic principle should be the same for GTK+-1.2
or GTK+-1.4.)

Regards,
                                        Owen



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