Re: Support for SpaceNavigator

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

 



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 theevents are queuing up. So what should be done is implementing eventcompression on the incoming events. Instead of reading them one-by-oneand creating an action from every incoming event, the linux-input moduleshould read all the available events from the queue and compress them.If a number of relative events on the same axis are following eachother, this can be combined into a single relative event with the sum ofall event values. From a series of absolute events all events but thelast can be discarded.
For illustration, here's some code from a different project that doessomething 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 listGimp-developer@xxxxxxxxxxxxxxxxxxxxxxxxxxx://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux