button_state_to_str(t->button.state));
}
-int
+void
tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
{
struct tp_touch *t;
if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time);
}
-
- return 0;
}
static void
tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now);
}
-int
+void
tp_process_button(struct tp_dispatch *tp,
const struct input_event *e,
uint64_t time)
log_bug_kernel(libinput,
"received %s button event on a clickpad\n",
libevdev_event_code_get_name(EV_KEY, e->code));
- return 0;
+ return;
}
if (e->value) {
tp->buttons.state &= ~mask;
tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
}
-
- return 0;
}
void
want_config_option);
}
-int
+void
tp_init_buttons(struct tp_dispatch *tp,
struct evdev_device *device)
{
tp_libinput_context(tp),
tp_button_handle_timeout, t);
}
-
- return 0;
}
void
tp_edge_scroll_handle_event(t->tp, t, SCROLL_EVENT_TIMEOUT);
}
-int
+void
tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
{
struct tp_touch *t;
tp_libinput_context(tp),
tp_edge_scroll_handle_timeout, t);
}
-
- return 0;
}
void
}
}
-int
+void
tp_init_gesture(struct tp_dispatch *tp)
{
/* two-finger scrolling is always enabled, this flag just
libinput_timer_init(&tp->gesture.finger_count_switch_timer,
tp_libinput_context(tp),
tp_gesture_finger_count_switch_timeout, tp);
- return 0;
}
void
return tp_drag_lock_default(evdev);
}
-int
+void
tp_init_tap(struct tp_dispatch *tp)
{
tp->tap.config.count = tp_tap_config_count;
libinput_timer_init(&tp->tap.timer,
tp_libinput_context(tp),
tp_tap_handle_timeout, tp);
-
- return 0;
}
void
struct evdev_device *device = tp->device;
int res_x, res_y;
struct motion_filter *filter;
- int rc;
res_x = tp->device->abs.absinfo_x->resolution;
res_y = tp->device->abs.absinfo_y->resolution;
if (!filter)
return -1;
- rc = evdev_device_init_pointer_acceleration(tp->device, filter);
- if (rc != 0)
- return rc;
+ evdev_device_init_pointer_acceleration(tp->device, filter);
/* we override the profile hooks for accel configuration with hooks
* that don't allow selection of profiles */
return tp_scroll_get_default_method(tp);
}
-static int
+static void
tp_init_scroll(struct tp_dispatch *tp, struct evdev_device *device)
{
- if (tp_edge_scroll_init(tp, device) != 0)
- return -1;
+ tp_edge_scroll_init(tp, device);
evdev_init_natural_scroll(device);
/* In mm for touchpads with valid resolution, see tp_init_accel() */
tp->device->scroll.threshold = 0.0;
tp->device->scroll.direction_lock_threshold = 5.0;
-
- return 0;
}
static int
LIBINPUT_CONFIG_DWT_DISABLED;
}
-static int
+static void
tp_init_dwt(struct tp_dispatch *tp,
struct evdev_device *device)
{
if (tp_dwt_device_is_blacklisted(device))
- return 0;
+ return;
tp->dwt.config.is_available = tp_dwt_config_is_available;
tp->dwt.config.set_enabled = tp_dwt_config_set;
tp->dwt.dwt_enabled = tp_dwt_default_enabled(tp);
device->base.config.dwt = &tp->dwt.config;
- return 0;
+ return;
}
-static int
+static void
tp_init_palmdetect(struct tp_dispatch *tp,
struct evdev_device *device)
{
/* Wacom doesn't have internal touchpads */
if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
- return 0;
+ return;
/* Enable palm detection on touchpads >= 70 mm. Anything smaller
probably won't need it, until we find out it does */
if (width/device->abs.absinfo_x->resolution < 70)
- return 0;
+ return;
/* palm edges are 5% of the width on each side */
tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05;
tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05;
tp->palm.monitor_trackpoint = true;
-
- return 0;
}
-static int
+static void
tp_init_sendevents(struct tp_dispatch *tp,
struct evdev_device *device)
{
libinput_timer_init(&tp->dwt.keyboard_timer,
tp_libinput_context(tp),
tp_keyboard_timeout, tp);
- return 0;
}
-static int
+static void
tp_init_thumb(struct tp_dispatch *tp)
{
struct evdev_device *device = tp->device;
double threshold;
if (!tp->buttons.is_clickpad)
- return 0;
+ return;
/* if the touchpad is less than 50mm high, skip thumb detection.
* it's too small to meaningfully interact with a thumb on the
* touchpad */
evdev_device_get_size(device, &w, &h);
if (h < 50)
- return 0;
+ return;
tp->thumb.detect_thumbs = true;
tp->thumb.threshold = INT_MAX;
"thumb: enabled thumb detection%s on '%s'\n",
tp->thumb.threshold != INT_MAX ? " (+pressure)" : "",
device->devname);
-
- return 0;
}
static int
return -1;
}
-static int
+static void
tp_init_default_resolution(struct tp_dispatch *tp,
struct evdev_device *device)
{
int xres, yres;
if (!device->abs.fake_resolution)
- return 0 ;
+ return;
/* we only get here if
* - the touchpad provides no resolution
libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_X, xres);
libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_Y, yres);
device->abs.fake_resolution = 0;
-
- return 0;
}
static inline void
if (tp_sanity_check(tp, device) != 0)
return -1;
- if (tp_init_default_resolution(tp, device) != 0)
- return -1;
+ tp_init_default_resolution(tp, device);
if (tp_init_slots(tp, device) != 0)
return -1;
if (tp_init_accel(tp) != 0)
return -1;
- if (tp_init_tap(tp) != 0)
- return -1;
-
- if (tp_init_buttons(tp, device) != 0)
- return -1;
-
- if (tp_init_dwt(tp, device) != 0)
- return -1;
-
- if (tp_init_palmdetect(tp, device) != 0)
- return -1;
-
- if (tp_init_sendevents(tp, device) != 0)
- return -1;
-
- if (tp_init_scroll(tp, device) != 0)
- return -1;
-
- if (tp_init_gesture(tp) != 0)
- return -1;
-
- if (tp_init_thumb(tp) != 0)
- return -1;
+ tp_init_tap(tp);
+ tp_init_buttons(tp, device);
+ tp_init_dwt(tp, device);
+ tp_init_palmdetect(tp, device);
+ tp_init_sendevents(tp, device);
+ tp_init_scroll(tp, device);
+ tp_init_gesture(tp);
+ tp_init_thumb(tp);
device->seat_caps |= EVDEV_DEVICE_POINTER;
if (tp->gesture.enabled)
int
tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time);
-int
+void
tp_init_tap(struct tp_dispatch *tp);
void
tp_remove_tap(struct tp_dispatch *tp);
-int
+void
tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device);
void
void
tp_remove_buttons(struct tp_dispatch *tp);
-int
+void
tp_process_button(struct tp_dispatch *tp,
const struct input_event *e,
uint64_t time);
int
tp_post_button_events(struct tp_dispatch *tp, uint64_t time);
-int
+void
tp_button_handle_state(struct tp_dispatch *tp, uint64_t time);
int
bool
tp_tap_dragging(const struct tp_dispatch *tp);
-int
+void
tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device);
void
uint32_t
tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t);
-int
+void
tp_init_gesture(struct tp_dispatch *tp);
void
{
const struct input_absinfo *x, *y;
struct motion_filter *filter;
- int rc;
x = device->abs.absinfo_x;
y = device->abs.absinfo_y;
if (!filter)
return -1;
- rc = evdev_device_init_pointer_acceleration(device, filter);
- if (rc != 0)
- return rc;
+ evdev_device_init_pointer_acceleration(device, filter);
/* we override the profile hooks for accel configuration with hooks
* that don't allow selection of profiles */
return 0;
}
-int
+void
evdev_init_left_handed(struct evdev_device *device,
void (*change_to_left_handed)(struct evdev_device *))
{
device->left_handed.enabled = false;
device->left_handed.want_enabled = false;
device->left_handed.change_to_enabled = change_to_left_handed;
-
- return 0;
}
static uint32_t
return 0;
}
-static int
+static void
evdev_init_button_scroll(struct evdev_device *device,
void (*change_scroll_method)(struct evdev_device *))
{
device->scroll.button = evdev_scroll_get_default_button((struct libinput_device *)device);
device->scroll.want_button = device->scroll.button;
device->scroll.change_scroll_method = change_scroll_method;
-
- return 0;
}
void
dispatch->interface = &fallback_interface;
- if (evdev_device->left_handed.want_enabled &&
- evdev_init_left_handed(evdev_device,
- evdev_change_to_left_handed) == -1) {
- free(dispatch);
- return NULL;
- }
+ if (evdev_device->left_handed.want_enabled)
+ evdev_init_left_handed(evdev_device,
+ evdev_change_to_left_handed);
- if (evdev_device->scroll.want_button &&
- evdev_init_button_scroll(evdev_device,
- evdev_change_scroll_method) == -1) {
- free(dispatch);
- return NULL;
- }
+ if (evdev_device->scroll.want_button)
+ evdev_init_button_scroll(evdev_device,
+ evdev_change_scroll_method);
if (evdev_device->scroll.natural_scrolling_enabled)
evdev_init_natural_scroll(evdev_device);
if (!filter)
return -1;
- return evdev_device_init_pointer_acceleration(device, filter);
+ evdev_device_init_pointer_acceleration(device, filter);
+
+ return 0;
}
static int
return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
}
-int
+void
evdev_device_init_pointer_acceleration(struct evdev_device *device,
struct motion_filter *filter)
{
evdev_accel_config_set_speed(&device->base,
evdev_accel_config_get_default_speed(&device->base));
}
-
- return 0;
}
static inline int
evdev_init_calibration(struct evdev_device *device,
struct evdev_dispatch *dispatch);
-int
+void
evdev_device_init_pointer_acceleration(struct evdev_device *device,
struct motion_filter *filter);
return value/absinfo->resolution;
}
-int
+void
evdev_init_left_handed(struct evdev_device *device,
void (*change_to_left_handed)(struct evdev_device *));