Rename evdev_input_device::type to pending_events

Since that's what it actually is, rather than a description of the
device as such.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
dev
Daniel Stone 13 years ago committed by Kristian Høgsberg
parent a62e804c7e
commit 1d637772c8
  1. 2
      src/evdev-private.h
  2. 2
      src/evdev-touchpad.c
  3. 44
      src/evdev.c

@ -68,7 +68,7 @@ struct evdev_input_device {
wl_fixed_t dx, dy; wl_fixed_t dx, dy;
} rel; } rel;
enum evdev_event_type type; enum evdev_event_type pending_events;
int is_mt; int is_mt;
}; };

@ -375,7 +375,7 @@ touchpad_update_state(struct touchpad_dispatch *touchpad, uint32_t time)
touchpad->device->rel.dx = wl_fixed_from_double(dx); touchpad->device->rel.dx = wl_fixed_from_double(dx);
touchpad->device->rel.dy = wl_fixed_from_double(dy); touchpad->device->rel.dy = wl_fixed_from_double(dy);
touchpad->device->type |= EVDEV_RELATIVE_MOTION; touchpad->device->pending_events |= EVDEV_RELATIVE_MOTION;
} }
} }

@ -73,23 +73,23 @@ evdev_process_touch(struct evdev_input_device *device,
break; break;
case ABS_MT_TRACKING_ID: case ABS_MT_TRACKING_ID:
if (e->value >= 0) if (e->value >= 0)
device->type |= EVDEV_ABSOLUTE_MT_DOWN; device->pending_events |= EVDEV_ABSOLUTE_MT_DOWN;
else else
device->type |= EVDEV_ABSOLUTE_MT_UP; device->pending_events |= EVDEV_ABSOLUTE_MT_UP;
break; break;
case ABS_MT_POSITION_X: case ABS_MT_POSITION_X:
device->mt.x[device->mt.slot] = device->mt.x[device->mt.slot] =
(e->value - device->abs.min_x) * screen_width / (e->value - device->abs.min_x) * screen_width /
(device->abs.max_x - device->abs.min_x) + (device->abs.max_x - device->abs.min_x) +
device->output->x; device->output->x;
device->type |= EVDEV_ABSOLUTE_MT_MOTION; device->pending_events |= EVDEV_ABSOLUTE_MT_MOTION;
break; break;
case ABS_MT_POSITION_Y: case ABS_MT_POSITION_Y:
device->mt.y[device->mt.slot] = device->mt.y[device->mt.slot] =
(e->value - device->abs.min_y) * screen_height / (e->value - device->abs.min_y) * screen_height /
(device->abs.max_y - device->abs.min_y) + (device->abs.max_y - device->abs.min_y) +
device->output->y; device->output->y;
device->type |= EVDEV_ABSOLUTE_MT_MOTION; device->pending_events |= EVDEV_ABSOLUTE_MT_MOTION;
break; break;
} }
} }
@ -107,14 +107,14 @@ evdev_process_absolute_motion(struct evdev_input_device *device,
(e->value - device->abs.min_x) * screen_width / (e->value - device->abs.min_x) * screen_width /
(device->abs.max_x - device->abs.min_x) + (device->abs.max_x - device->abs.min_x) +
device->output->x; device->output->x;
device->type |= EVDEV_ABSOLUTE_MOTION; device->pending_events |= EVDEV_ABSOLUTE_MOTION;
break; break;
case ABS_Y: case ABS_Y:
device->abs.y = device->abs.y =
(e->value - device->abs.min_y) * screen_height / (e->value - device->abs.min_y) * screen_height /
(device->abs.max_y - device->abs.min_y) + (device->abs.max_y - device->abs.min_y) +
device->output->y; device->output->y;
device->type |= EVDEV_ABSOLUTE_MOTION; device->pending_events |= EVDEV_ABSOLUTE_MOTION;
break; break;
} }
} }
@ -126,11 +126,11 @@ evdev_process_relative(struct evdev_input_device *device,
switch (e->code) { switch (e->code) {
case REL_X: case REL_X:
device->rel.dx += wl_fixed_from_int(e->value); device->rel.dx += wl_fixed_from_int(e->value);
device->type |= EVDEV_RELATIVE_MOTION; device->pending_events |= EVDEV_RELATIVE_MOTION;
break; break;
case REL_Y: case REL_Y:
device->rel.dy += wl_fixed_from_int(e->value); device->rel.dy += wl_fixed_from_int(e->value);
device->type |= EVDEV_RELATIVE_MOTION; device->pending_events |= EVDEV_RELATIVE_MOTION;
break; break;
case REL_WHEEL: case REL_WHEEL:
notify_axis(&device->master->base.seat, notify_axis(&device->master->base.seat,
@ -184,45 +184,45 @@ evdev_flush_motion(struct evdev_input_device *device, uint32_t time)
{ {
struct weston_seat *master = &device->master->base; struct weston_seat *master = &device->master->base;
if (!device->type) if (!device->pending_events)
return; return;
if (device->type & EVDEV_RELATIVE_MOTION) { if (device->pending_events & EVDEV_RELATIVE_MOTION) {
notify_motion(&master->seat, time, notify_motion(&master->seat, time,
master->seat.pointer->x + device->rel.dx, master->seat.pointer->x + device->rel.dx,
master->seat.pointer->y + device->rel.dy); master->seat.pointer->y + device->rel.dy);
device->type &= ~EVDEV_RELATIVE_MOTION; device->pending_events &= ~EVDEV_RELATIVE_MOTION;
device->rel.dx = 0; device->rel.dx = 0;
device->rel.dy = 0; device->rel.dy = 0;
} }
if (device->type & EVDEV_ABSOLUTE_MT_DOWN) { if (device->pending_events & EVDEV_ABSOLUTE_MT_DOWN) {
notify_touch(&master->seat, time, notify_touch(&master->seat, time,
device->mt.slot, device->mt.slot,
wl_fixed_from_int(device->mt.x[device->mt.slot]), wl_fixed_from_int(device->mt.x[device->mt.slot]),
wl_fixed_from_int(device->mt.y[device->mt.slot]), wl_fixed_from_int(device->mt.y[device->mt.slot]),
WL_TOUCH_DOWN); WL_TOUCH_DOWN);
device->type &= ~EVDEV_ABSOLUTE_MT_DOWN; device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN;
device->type &= ~EVDEV_ABSOLUTE_MT_MOTION; device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
} }
if (device->type & EVDEV_ABSOLUTE_MT_MOTION) { if (device->pending_events & EVDEV_ABSOLUTE_MT_MOTION) {
notify_touch(&master->seat, time, notify_touch(&master->seat, time,
device->mt.slot, device->mt.slot,
wl_fixed_from_int(device->mt.x[device->mt.slot]), wl_fixed_from_int(device->mt.x[device->mt.slot]),
wl_fixed_from_int(device->mt.y[device->mt.slot]), wl_fixed_from_int(device->mt.y[device->mt.slot]),
WL_TOUCH_MOTION); WL_TOUCH_MOTION);
device->type &= ~EVDEV_ABSOLUTE_MT_DOWN; device->pending_events &= ~EVDEV_ABSOLUTE_MT_DOWN;
device->type &= ~EVDEV_ABSOLUTE_MT_MOTION; device->pending_events &= ~EVDEV_ABSOLUTE_MT_MOTION;
} }
if (device->type & EVDEV_ABSOLUTE_MT_UP) { if (device->pending_events & EVDEV_ABSOLUTE_MT_UP) {
notify_touch(&master->seat, time, device->mt.slot, 0, 0, notify_touch(&master->seat, time, device->mt.slot, 0, 0,
WL_TOUCH_UP); WL_TOUCH_UP);
device->type &= ~EVDEV_ABSOLUTE_MT_UP; device->pending_events &= ~EVDEV_ABSOLUTE_MT_UP;
} }
if (device->type & EVDEV_ABSOLUTE_MOTION) { if (device->pending_events & EVDEV_ABSOLUTE_MOTION) {
notify_motion(&master->seat, time, notify_motion(&master->seat, time,
wl_fixed_from_int(device->abs.x), wl_fixed_from_int(device->abs.x),
wl_fixed_from_int(device->abs.y)); wl_fixed_from_int(device->abs.y));
device->type &= ~EVDEV_ABSOLUTE_MOTION; device->pending_events &= ~EVDEV_ABSOLUTE_MOTION;
} }
} }
@ -276,7 +276,7 @@ evdev_process_events(struct evdev_input_device *device,
struct input_event *e, *end; struct input_event *e, *end;
uint32_t time = 0; uint32_t time = 0;
device->type = 0; device->pending_events = 0;
e = ev; e = ev;
end = e + count; end = e + count;

Loading…
Cancel
Save