Add the shell for a multitouch-compatible touchpad implementation

Doesn't do anything but initialize and destroy. This is not a permanent
separate implementation, it's just easier to start this way and then switch
over than to add to the current one.

Temporary measure: LIBINPUT_NEW_TOUCHPAD_DRIVER environment variable can be
used to enable the new driver

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-02-06 15:05:36 +10:00
parent e1d25a9539
commit d2e026d8ae
4 changed files with 84 additions and 1 deletions

View file

@ -11,6 +11,7 @@ libinput_la_SOURCES = \
libinput-util.h \
evdev.c \
evdev.h \
evdev-mt-touchpad.c \
evdev-touchpad.c \
filter.c \
filter.h \

76
src/evdev-mt-touchpad.c Normal file
View file

@ -0,0 +1,76 @@
/*
* Copyright © 2014 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software
* without specific, written prior permission. The copyright holders make
* no representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include "evdev.h"
struct touchpad_dispatch {
struct evdev_dispatch base;
struct evdev_device *device;
};
static void
touchpad_process(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *e,
uint32_t time)
{
}
static void
touchpad_destroy(struct evdev_dispatch *dispatch)
{
free(dispatch);
}
static struct evdev_dispatch_interface touchpad_interface = {
touchpad_process,
touchpad_destroy
};
static int
touchpad_init(struct touchpad_dispatch *touchpad,
struct evdev_device *device)
{
touchpad->base.interface = &touchpad_interface;
touchpad->device = device;
return 0;
}
struct evdev_dispatch *
evdev_mt_touchpad_create(struct evdev_device *device)
{
struct touchpad_dispatch *touchpad;
touchpad = zalloc(sizeof *touchpad);
if (!touchpad)
return NULL;
if (touchpad_init(touchpad, device) != 0) {
free(touchpad);
return NULL;
}
return &touchpad->base;
}

View file

@ -600,7 +600,10 @@ evdev_configure_device(struct evdev_device *device)
if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_TOOL_FINGER) &&
!libevdev_has_event_code(device->evdev, EV_KEY, BTN_TOOL_PEN) &&
(has_abs || has_mt)) {
device->dispatch = evdev_touchpad_create(device);
if (getenv("LIBINPUT_NEW_TOUCHPAD_DRIVER") && has_mt)
device->dispatch = evdev_mt_touchpad_create(device);
else
device->dispatch = evdev_touchpad_create(device);
}
for (i = KEY_ESC; i < KEY_MAX; i++) {
if (i >= BTN_MISC && i < KEY_OK)

View file

@ -118,6 +118,9 @@ evdev_device_create(struct libinput_seat *seat,
struct evdev_dispatch *
evdev_touchpad_create(struct evdev_device *device);
struct evdev_dispatch *
evdev_mt_touchpad_create(struct evdev_device *device);
void
evdev_device_proces_event(struct libinput_event *event);