enum button_event event,
uint64_t time)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
enum button_state current = t->button.state;
switch(t->button.state) {
const struct input_event *e,
uint64_t time)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
uint32_t mask = 1 << (e->code - BTN_LEFT);
/* Ignore other buttons on clickpads */
tp_init_buttons(struct tp_dispatch *tp,
struct evdev_device *device)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
struct tp_touch *t;
int width, height;
double diagonal;
tp_for_each_touch(tp, t) {
t->button.state = BUTTON_STATE_NONE;
libinput_timer_init(&t->button.timer,
- tp->device->base.seat->libinput,
+ tp_libinput_context(tp),
tp_button_handle_timeout, t);
}
struct tp_touch *t,
enum scroll_event event)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case SCROLL_EVENT_TOUCH:
struct tp_touch *t,
enum scroll_event event)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case SCROLL_EVENT_TOUCH:
struct tp_touch *t,
enum scroll_event event)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case SCROLL_EVENT_TOUCH:
struct tp_touch *t,
enum scroll_event event)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case SCROLL_EVENT_TOUCH:
struct tp_touch *t,
enum scroll_event event)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
enum tp_edge_scroll_touch_state current = t->scroll.edge_state;
switch (current) {
tp_for_each_touch(tp, t) {
t->scroll.direction = -1;
libinput_timer_init(&t->scroll.timer,
- device->base.seat->libinput,
+ tp_libinput_context(tp),
tp_edge_scroll_handle_timeout, t);
}
struct tp_touch *t,
enum tap_event event, uint64_t time)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case TAP_EVENT_TOUCH:
struct tp_touch *t,
enum tap_event event, uint64_t time)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case TAP_EVENT_MOTION:
struct tp_touch *t,
enum tap_event event, uint64_t time)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
switch (event) {
case TAP_EVENT_RELEASE:
enum tap_event event,
uint64_t time)
{
- struct libinput *libinput = tp->device->base.seat->libinput;
+ struct libinput *libinput = tp_libinput_context(tp);
enum tp_tap_state current;
current = tp->tap.state;
tp->tap.enabled = tp_tap_default(tp->device);
libinput_timer_init(&tp->tap.timer,
- tp->device->base.seat->libinput,
+ tp_libinput_context(tp),
tp_tap_handle_timeout, tp);
return 0;
static void
tp_clear_state(struct tp_dispatch *tp)
{
- uint64_t now = libinput_now(tp->device->base.seat->libinput);
+ uint64_t now = libinput_now(tp_libinput_context(tp));
struct tp_touch *t;
/* Unroll the touchpad state.
{
struct evdev_device *evdev = (struct evdev_device*)device;
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
- uint64_t time = libinput_now(device->seat->libinput);
+ uint64_t time = libinput_now(tp_libinput_context(tp));
if (method == tp->scroll.method)
return LIBINPUT_CONFIG_STATUS_SUCCESS;
struct evdev_device *device)
{
libinput_timer_init(&tp->sendevents.trackpoint_timer,
- tp->device->base.seat->libinput,
+ tp_libinput_context(tp),
tp_trackpoint_timeout, tp);
libinput_timer_init(&tp->dwt.keyboard_timer,
- tp->device->base.seat->libinput,
+ tp_libinput_context(tp),
tp_keyboard_timeout, tp);
return 0;
}
#define tp_for_each_touch(_tp, _t) \
for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++)
+static inline struct libinput*
+tp_libinput_context(struct tp_dispatch *tp)
+{
+ return tp->device->base.seat->libinput;
+}
+
static inline struct normalized_coords
tp_normalize_delta(struct tp_dispatch *tp, struct device_float_coords delta)
{