From a8ffc096bed1b9ebed7f2d870ddf5d743e2c83ee Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 Sep 2014 16:22:38 +0200 Subject: [PATCH] touchpad: Keep track of associated trackpoint device The top soft buttons are intended for use with a trackpoint, and to e.g. make middle button scrolling work correctly, we must post the events for these "buttons" through the trackpoint device. This commit is a preparation patch for this, it adds a link to the trackpoint to the touchpad, but does not yet do anything with it. Signed-off-by: Peter Hutterer Signed-off-by: Hans de Goede Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad.c | 7 +++++++ src/evdev-mt-touchpad.h | 2 ++ src/evdev.c | 9 +++++++++ src/evdev.h | 1 + 4 files changed, 19 insertions(+) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 4161d9b7..4639231b 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -642,6 +642,10 @@ tp_device_added(struct evdev_device *device, { struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; + if (tp->buttons.trackpoint == NULL && + (added_device->tags & EVDEV_TAG_TRACKPOINT)) + tp->buttons.trackpoint = added_device; + if (tp->sendevents.current_mode != LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) return; @@ -657,6 +661,9 @@ tp_device_removed(struct evdev_device *device, struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; struct libinput_device *dev; + if (removed_device == tp->buttons.trackpoint) + tp->buttons.trackpoint = NULL; + if (tp->sendevents.current_mode != LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) return; diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 8671f797..4a16db9d 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -198,6 +198,8 @@ struct tp_dispatch { int32_t rightbutton_left_edge; int32_t leftbutton_right_edge; } top_area; + + struct evdev_device *trackpoint; } buttons; /* physical buttons */ enum touchpad_event queued; diff --git a/src/evdev.c b/src/evdev.c index cb43c271..4e9db2fb 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -606,6 +606,14 @@ evdev_tag_external_mouse(struct evdev_device *device, } } +static void +evdev_tag_trackpoint(struct evdev_device *device, + struct udev_device *udev_device) +{ + if (libevdev_has_property(device->evdev, INPUT_PROP_POINTING_STICK)) + device->tags |= EVDEV_TAG_TRACKPOINT; +} + static void fallback_process(struct evdev_dispatch *dispatch, struct evdev_device *device, @@ -644,6 +652,7 @@ fallback_tag_device(struct evdev_device *device, struct udev_device *udev_device) { evdev_tag_external_mouse(device, udev_device); + evdev_tag_trackpoint(device, udev_device); } static int diff --git a/src/evdev.h b/src/evdev.h index 4047a6d9..2da30f84 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -53,6 +53,7 @@ enum evdev_device_seat_capability { enum evdev_device_tags { EVDEV_TAG_EXTERNAL_MOUSE = (1 << 0), EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1), + EVDEV_TAG_TRACKPOINT = (1 << 2), }; struct mt_slot { -- 2.34.1