[PATCH libinput 01/19] Add the shell for a multitouch-compatible touchpad implementation
Peter Hutterer
peter.hutterer at who-t.net
Sun Feb 16 22:48:20 PST 2014
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 at who-t.net>
---
src/Makefile.am | 1 +
src/evdev-mt-touchpad.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++
src/evdev.c | 5 +++-
src/evdev.h | 3 ++
4 files changed, 84 insertions(+), 1 deletion(-)
create mode 100644 src/evdev-mt-touchpad.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 6e27b3b..c6afb82 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,6 +10,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
index 0000000..a360651
--- /dev/null
+++ b/src/evdev-mt-touchpad.c
@@ -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;
+}
diff --git a/src/evdev.c b/src/evdev.c
index d8dff65..ffa8557 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -565,7 +565,10 @@ evdev_configure_device(struct evdev_device *device)
if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
!TEST_BIT(key_bits, 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)
diff --git a/src/evdev.h b/src/evdev.h
index 3c9f93a..ce7fbb3 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -123,6 +123,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);
--
1.8.4.2
More information about the wayland-devel
mailing list