touchpad: Keep track of associated trackpoint device
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 16 Sep 2014 14:22:38 +0000 (16:22 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 18 Sep 2014 03:29:42 +0000 (13:29 +1000)
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 <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad.c
src/evdev-mt-touchpad.h
src/evdev.c
src/evdev.h

index 4161d9b78c7bbbdc2e1575113d9e8760f73c360b..4639231b4c253e7136fa64ae369b2f51a8b541fc 100644 (file)
@@ -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;
index 8671f79784278ab001db8e80936d92c183ae44f1..4a16db9d7dad259016c14e262c0aba17584a00d2 100644 (file)
@@ -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;
index cb43c271f4f63ac6c517587f11a610ec4c01ccb9..4e9db2fba6faead4fb1b6ed45c9463519bc01ec7 100644 (file)
@@ -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
index 4047a6d9e84f419f7e0ee7c31472364bf8a20e1a..2da30f8414c16ced624528e828f223bd81ae7515 100644 (file)
@@ -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 {