[PATCH weston 2/5] evdev: Add event process dispatching
jadahl at gmail.com
Thu May 10 14:38:09 PDT 2012
On Thu, May 10, 2012 at 11:11 PM, Kristian Høgsberg <hoegsberg at gmail.com> wrote:
> On Wed, May 09, 2012 at 11:31:43PM +0200, Jonas Ådahl wrote:
>> By adding an 'evdev_dispatch' struct to the dispatch_list in
>> 'evdev_input_device' the 'process' function in the associated interface
>> will be called with received input events. The process function can
>> either handle the event and return a non-zero integer or return zero and
>> the generic fallback handlers will process the event.
> I agree that we need to get evdev a little more under control, but I
> was thinking that we'd be able to decide up front that a device is a
> touchpad, a mouse a keyboard or such. In evdev_configure_device()
> we'd decide what it is and just set a 'process' function pointer in
> evdev_input_device and all then events just go to that one handler.
> In other words, yes, we need to generalize this, but I'd like to avoid
> the list of dispatchers. We may want to do a list of device configure
> functions (one of them coming from evdev-touchpad.c) that
> evdev_configure_device() can loop through and call into.
We could, as you say, just set one handler, but still use the dispatch
interface (but maybe call it something else) because of the destroy
function. We'd also need a handler specific data pointer. Maybe a
struct evdev_device_interface (identical to evdev_disatch_interface)
with a void *device_data instead of the dispatch list? Then we could
have a list with configure function pointers that detect and
potentially provide an interface and a data pointer. Evdev would run
through the array until anything was detected, and then set the
provided interface and data pointer.
More information about the wayland-devel