if (libevdev_has_property(evdev->evdev, INPUT_PROP_POINTING_STICK))
return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
- else
- return LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
+
+ /* Mice without a scroll wheel but with middle button have on-button
+ * scrolling by default */
+ if (!libevdev_has_event_code(evdev->evdev, EV_REL, REL_WHEEL) &&
+ !libevdev_has_event_code(evdev->evdev, EV_REL, REL_HWHEEL) &&
+ libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE))
+ return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
+
+ return LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
}
static enum libinput_config_status
if (libevdev_has_property(evdev->evdev, INPUT_PROP_POINTING_STICK))
return BTN_MIDDLE;
- else
- return 0;
+
+ /* A device that defaults to button scrolling defaults
+ to BTN_MIDDLE */
+ if (evdev_scroll_get_default_method(device) ==
+ LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
+ libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE))
+ return BTN_MIDDLE;
+
+ return 0;
}
static int
litest-generic-singletouch.c \
litest-keyboard.c \
litest-keyboard-razer-blackwidow.c \
+ litest-logitech-trackball.c \
litest-mouse.c \
litest-mouse-roccat.c \
litest-ms-surface-cover.c \
--- /dev/null
+/*
+ * Copyright © 2015 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "litest.h"
+#include "litest-int.h"
+
+static void litest_logitech_trackball_setup(void)
+{
+ struct litest_device *d = litest_create_device(LITEST_LOGITECH_TRACKBALL);
+ litest_set_current_device(d);
+}
+
+static struct input_id input_id = {
+ .bustype = 0x3,
+ .vendor = 0x46d,
+ .product = 0xc408,
+};
+
+static int events[] = {
+ EV_KEY, BTN_LEFT,
+ EV_KEY, BTN_RIGHT,
+ EV_KEY, BTN_MIDDLE,
+ EV_KEY, BTN_SIDE,
+ EV_KEY, BTN_EXTRA,
+ EV_REL, REL_X,
+ EV_REL, REL_Y,
+ -1 , -1,
+};
+
+struct litest_test_device litest_logitech_trackball_device = {
+ .type = LITEST_LOGITECH_TRACKBALL,
+ .features = LITEST_RELATIVE | LITEST_BUTTON,
+ .shortname = "logitech trackball",
+ .setup = litest_logitech_trackball_setup,
+ .interface = NULL,
+
+ .name = "Logitech USB Trackball",
+ .id = &input_id,
+ .absinfo = NULL,
+ .events = events,
+};
extern struct litest_test_device litest_wheel_only_device;
extern struct litest_test_device litest_mouse_roccat_device;
extern struct litest_test_device litest_ms_surface_cover_device;
+extern struct litest_test_device litest_logitech_trackball_device;
struct litest_test_device* devices[] = {
&litest_synaptics_clickpad_device,
&litest_wheel_only_device,
&litest_mouse_roccat_device,
&litest_ms_surface_cover_device,
+ &litest_logitech_trackball_device,
NULL,
};
LITEST_KEYBOARD_BLACKWIDOW = -20,
LITEST_WHEEL_ONLY = -21,
LITEST_MOUSE_ROCCAT = -22,
+ LITEST_LOGITECH_TRACKBALL = -23,
};
enum litest_device_feature {
}
END_TEST
+START_TEST(pointer_scroll_nowheel_defaults)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput_device *device = dev->libinput_device;
+ enum libinput_config_scroll_method method;
+ uint32_t button;
+
+ method = libinput_device_config_scroll_get_method(device);
+ ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
+
+ method = libinput_device_config_scroll_get_default_method(device);
+ ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
+
+ button = libinput_device_config_scroll_get_button(device);
+ ck_assert_int_eq(button, BTN_MIDDLE);
+ button = libinput_device_config_scroll_get_default_button(device);
+ ck_assert_int_eq(button, BTN_MIDDLE);
+}
+END_TEST
+
START_TEST(pointer_accel_defaults)
{
struct litest_device *dev = litest_current_device();
litest_add_no_device("pointer:button", pointer_seat_button_count);
litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_ANY);
litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY);
+ litest_add("pointer:scroll", pointer_scroll_nowheel_defaults, LITEST_RELATIVE|LITEST_BUTTON, LITEST_WHEEL);
litest_add("pointer:scroll", pointer_scroll_natural_defaults, LITEST_WHEEL, LITEST_ANY);
litest_add("pointer:scroll", pointer_scroll_natural_enable_config, LITEST_WHEEL, LITEST_ANY);
litest_add("pointer:scroll", pointer_scroll_natural_wheel, LITEST_WHEEL, LITEST_ANY);