From: Peter Hutterer Date: Wed, 14 Apr 2021 06:26:21 +0000 (+1000) Subject: touchpad: use some helper variables to make the code easier to read X-Git-Tag: 1.17.901~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16d5d78a4d369286ec0136e0a4310ab0f4536add;p=platform%2Fupstream%2Flibinput.git touchpad: use some helper variables to make the code easier to read Signed-off-by: Peter Hutterer --- diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 7d8933f..d7f075c 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -939,15 +939,18 @@ static bool tp_guess_clickpad(const struct tp_dispatch *tp, struct evdev_device *device) { bool is_clickpad; + bool has_left = libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT), + has_middle = libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE), + has_right = libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT); + is_clickpad = libevdev_has_property(device->evdev, INPUT_PROP_BUTTONPAD); - if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE) || - libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) { + if (has_middle || has_right) { if (is_clickpad) evdev_log_bug_kernel(device, "clickpad advertising right button\n"); - } else if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT) && + } else if (has_left & !is_clickpad && libevdev_get_id_vendor(device->evdev) != VENDOR_ID_APPLE) { evdev_log_bug_kernel(device,