Hi,

On Sun, 2009-08-23 at 15:52 +0200, Håvard Tørring wrote:

> It took me a little while to dig through the various layers, but I
> think I am approaching something that might end up as useful. One
> problem is that the events that are generated are qued up if the
> actions does not perform fast enough. The SpaceNavigator outputs a lot
> of events, and especially the zooming actions are slow. This means
> that with just a brief touch of the spacenavigator, the zoom level
> jumps from minimum to maximum.
> 
> I think that it does not make any sense to que up the events from this
> device. Are there any way I can prevent this? Is there any way to know
> if there are pending actions? This could be used to avoid sending new
> actions as long as the previous ones are still pending.

I don't think the actions are queued up. What is more likely is that the
events are queuing up. So what should be done is implementing event
compression on the incoming events. Instead of reading them one-by-one
and creating an action from every incoming event, the linux-input module
should read all the available events from the queue and compress them.
If a number of relative events on the same axis are following each
other, this can be combined into a single relative event with the sum of
all event values. From a series of absolute events all events but the
last can be discarded.

For illustration, here's some code from a different project that does
something similar (though somewhat simpler):


        gsize               bytes_read = 0;
        struct input_event  buf[8];

        if (g_io_channel_read_chars (io,
                                     (gchar *) &buf, sizeof (buf),
                                     &bytes_read,
                                     NULL) == G_IO_STATUS_NORMAL)
          {
                const struct input_event *event;

                const gint num   = (bytes_read /
                                    sizeof (struct input_event));
                gint       value = 0;
                gint       i;

                for (event = buf, i = 0; i < num; event++, i++)
                {
                        if (event->type == EV_REL &&
                            event->code == REL_X)
                                value += event->value;
                }

                if (value)
                        ; // process the compressed event here
        }


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to