Add the shell for a multitouch-compatible touchpad implementation
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 6 Feb 2014 05:05:36 +0000 (15:05 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 24 Mar 2014 04:56:40 +0000 (14:56 +1000)
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>
src/Makefile.am
src/evdev-mt-touchpad.c [new file with mode: 0644]
src/evdev.c
src/evdev.h

index 8c6d9354e2d4c98f9dbc471402a7f422c878352b..ae1eed02b22ed36a80cdd0640596f731879390db 100644 (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                        \
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
new file mode 100644 (file)
index 0000000..a360651
--- /dev/null
@@ -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;
+}
index 5d01e3bcf418b63563bb478c452e4f0e4eb11ec6..bb2913f84768df5fb522b3e86039624b2f872838 100644 (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)
index b83a2f9d66179346c4c966caa9543c1fe4a47ce4..0ab95720fe79e58be703a6457ab1f2b706a7e3c7 100644 (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);