Lines Matching refs:dispatch
35 fallback_keyboard_notify_key(struct fallback_dispatch *dispatch,
51 fallback_lid_notify_toggle(struct fallback_dispatch *dispatch,
55 if (dispatch->lid.is_closed ^ dispatch->lid.is_closed_client_state) {
59 dispatch->lid.is_closed);
60 dispatch->lid.is_closed_client_state = dispatch->lid.is_closed;
65 fallback_notify_physical_button(struct fallback_dispatch *dispatch,
78 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
88 return dispatch->tablet_mode.sw.state ?
131 fallback_filter_defuzz_touch(struct fallback_dispatch *dispatch,
137 if (!dispatch->mt.want_hysteresis)
142 &dispatch->mt.hysteresis_margin);
155 fallback_rotate_relative(struct fallback_dispatch *dispatch,
158 struct device_float_coords rel = { dispatch->rel.x, dispatch->rel.y };
163 matrix_mult_vec_double(&dispatch->rotation.matrix, &rel.x, &rel.y);
169 fallback_flush_relative_motion(struct fallback_dispatch *dispatch,
179 struct device_float_coords raw = fallback_rotate_relative(dispatch, device);
181 dispatch->rel.x = 0;
182 dispatch->rel.y = 0;
207 fallback_flush_absolute_motion(struct fallback_dispatch *dispatch,
217 point = dispatch->abs.point;
224 fallback_flush_mt_down(struct fallback_dispatch *dispatch,
238 slot = &dispatch->mt.slots[slot_idx];
263 fallback_flush_mt_motion(struct fallback_dispatch *dispatch,
276 slot = &dispatch->mt.slots[slot_idx];
283 if (fallback_filter_defuzz_touch(dispatch, device, slot))
294 fallback_flush_mt_up(struct fallback_dispatch *dispatch,
307 slot = &dispatch->mt.slots[slot_idx];
322 fallback_flush_mt_cancel(struct fallback_dispatch *dispatch,
335 slot = &dispatch->mt.slots[slot_idx];
350 fallback_flush_st_down(struct fallback_dispatch *dispatch,
362 if (dispatch->abs.seat_slot != -1) {
369 dispatch->abs.seat_slot = seat_slot;
376 point = dispatch->abs.point;
385 fallback_flush_st_motion(struct fallback_dispatch *dispatch,
393 point = dispatch->abs.point;
396 seat_slot = dispatch->abs.seat_slot;
407 fallback_flush_st_up(struct fallback_dispatch *dispatch,
418 seat_slot = dispatch->abs.seat_slot;
419 dispatch->abs.seat_slot = -1;
432 fallback_flush_st_cancel(struct fallback_dispatch *dispatch,
443 seat_slot = dispatch->abs.seat_slot;
444 dispatch->abs.seat_slot = -1;
457 fallback_process_touch_button(struct fallback_dispatch *dispatch,
461 dispatch->pending_event |= (value) ?
467 fallback_process_key(struct fallback_dispatch *dispatch,
479 fallback_process_touch_button(dispatch,
496 if ((e->value && hw_is_key_down(dispatch, e->code)) ||
497 (e->value == 0 && !hw_is_key_down(dispatch, e->code)))
500 dispatch->pending_event |= EVDEV_KEY;
504 hw_set_key_down(dispatch, e->code, e->value);
511 dispatch,
524 fallback_process_touch(struct fallback_dispatch *dispatch,
529 struct mt_slot *slot = &dispatch->mt.slots[dispatch->mt.slot];
532 if ((size_t)e->value >= dispatch->mt.slots_len) {
536 dispatch->mt.slots_len);
537 e->value = dispatch->mt.slots_len - 1;
539 dispatch->mt.slot = e->value;
546 dispatch->pending_event |= EVDEV_ABSOLUTE_MT;
548 if (dispatch->mt.has_palm) {
551 dispatch->mt.slot,
566 dispatch->pending_event |= EVDEV_ABSOLUTE_MT;
573 dispatch->mt.slots[dispatch->mt.slot].point.x = e->value;
574 dispatch->pending_event |= EVDEV_ABSOLUTE_MT;
579 dispatch->mt.slots[dispatch->mt.slot].point.y = e->value;
580 dispatch->pending_event |= EVDEV_ABSOLUTE_MT;
600 dispatch->pending_event |= EVDEV_ABSOLUTE_MT;
607 fallback_process_absolute_motion(struct fallback_dispatch *dispatch,
614 dispatch->abs.point.x = e->value;
615 dispatch->pending_event |= EVDEV_ABSOLUTE_MOTION;
619 dispatch->abs.point.y = e->value;
620 dispatch->pending_event |= EVDEV_ABSOLUTE_MOTION;
630 struct fallback_dispatch *dispatch = fallback_dispatch(data);
632 if (!dispatch->lid.is_closed)
638 if (dispatch->lid.reliability == RELIABILITY_WRITE_OPEN) {
639 int fd = libevdev_get_fd(dispatch->device->evdev);
649 evdev_log_error(dispatch->device,
661 dispatch->lid.is_closed = false;
662 fallback_lid_notify_toggle(dispatch, dispatch->device, time);
666 fallback_lid_toggle_keyboard_listener(struct fallback_dispatch *dispatch,
679 dispatch);
686 fallback_lid_toggle_keyboard_listeners(struct fallback_dispatch *dispatch,
691 list_for_each(kbd, &dispatch->lid.paired_keyboard_list, link) {
695 fallback_lid_toggle_keyboard_listener(dispatch,
702 fallback_process_switch(struct fallback_dispatch *dispatch,
716 fallback_lid_toggle_keyboard_listeners(dispatch, is_closed);
718 if (dispatch->lid.is_closed == is_closed)
721 dispatch->lid.is_closed = is_closed;
722 fallback_lid_notify_toggle(dispatch, device, time);
725 if (dispatch->tablet_mode.sw.state == e->value)
728 dispatch->tablet_mode.sw.state = e->value;
758 fallback_process_relative(struct fallback_dispatch *dispatch,
767 dispatch->rel.x += e->value;
768 dispatch->pending_event |= EVDEV_RELATIVE_MOTION;
771 dispatch->rel.y += e->value;
772 dispatch->pending_event |= EVDEV_RELATIVE_MOTION;
776 fallback_wheel_process_relative(dispatch, device, e, time);
780 fallback_process_absolute(struct fallback_dispatch *dispatch,
786 fallback_process_touch(dispatch, device, e, time);
788 fallback_process_absolute_motion(dispatch, device, e);
793 fallback_any_button_down(struct fallback_dispatch *dispatch,
800 hw_is_key_down(dispatch, button))
807 fallback_arbitrate_touch(struct fallback_dispatch *dispatch,
812 evdev_transform_absolute(dispatch->device, &point);
814 if (dispatch->arbitration.state == ARBITRATION_IGNORE_RECT &&
815 point_in_rect(&point, &dispatch->arbitration.rect)) {
824 fallback_flush_mt_events(struct fallback_dispatch *dispatch,
830 for (size_t i = 0; i < dispatch->mt.slots_len; i++) {
831 struct mt_slot *slot = &dispatch->mt.slots[i];
844 sent = fallback_flush_mt_cancel(dispatch,
852 if (!fallback_arbitrate_touch(dispatch,
854 sent = fallback_flush_mt_down(dispatch,
861 sent = fallback_flush_mt_motion(dispatch,
867 sent = fallback_flush_mt_up(dispatch,
899 fallback_handle_state(struct fallback_dispatch *dispatch,
906 if (dispatch->pending_event & EVDEV_RELATIVE_MOTION)
907 fallback_flush_relative_motion(dispatch, device, time);
910 if (dispatch->pending_event & EVDEV_ABSOLUTE_TOUCH_DOWN) {
911 if (fallback_flush_st_down(dispatch, device, time))
913 } else if (dispatch->pending_event & EVDEV_ABSOLUTE_MOTION) {
915 if (fallback_flush_st_motion(dispatch,
920 fallback_flush_absolute_motion(dispatch,
926 if (dispatch->pending_event & EVDEV_ABSOLUTE_TOUCH_UP) {
927 if (fallback_flush_st_up(dispatch, device, time))
932 if (dispatch->pending_event & EVDEV_ABSOLUTE_MT)
933 need_touch_frame = fallback_flush_mt_events(dispatch,
940 fallback_wheel_handle_state(dispatch, device, time);
943 if (dispatch->pending_event & EVDEV_KEY) {
946 if (!hw_key_has_changed(dispatch, code))
956 fallback_debounce_handle_state(dispatch, time);
958 hw_key_update_last_state(dispatch);
961 dispatch->pending_event = EVDEV_NONE;
970 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
973 if (dispatch->arbitration.in_arbitration) {
985 fallback_process_relative(dispatch, device, event, time);
988 fallback_process_absolute(dispatch, device, event, time);
991 fallback_process_key(dispatch, device, event, time);
994 fallback_process_switch(dispatch, device, event, time);
997 fallback_handle_state(dispatch, device, time);
1003 cancel_touches(struct fallback_dispatch *dispatch,
1012 point = dispatch->abs.point;
1015 need_frame = fallback_flush_st_cancel(dispatch,
1019 for (idx = 0; idx < dispatch->mt.slots_len; idx++) {
1020 struct mt_slot *slot = &dispatch->mt.slots[idx];
1028 fallback_flush_mt_cancel(dispatch, device, idx, time))
1037 release_pressed_keys(struct fallback_dispatch *dispatch,
1061 dispatch,
1092 fallback_return_to_neutral_state(struct fallback_dispatch *dispatch,
1101 cancel_touches(dispatch, device, NULL, time);
1102 release_pressed_keys(dispatch, device, time);
1103 memset(dispatch->hw_key_mask, 0, sizeof(dispatch->hw_key_mask));
1104 memset(dispatch->hw_key_mask, 0, sizeof(dispatch->last_hw_key_mask));
1111 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
1113 fallback_return_to_neutral_state(dispatch, device);
1119 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
1122 libinput_timer_cancel(&dispatch->wheel.scroll_timer);
1123 libinput_timer_cancel(&dispatch->debounce.timer);
1124 libinput_timer_cancel(&dispatch->debounce.timer_short);
1125 libinput_timer_cancel(&dispatch->arbitration.arbitration_timer);
1127 libinput_device_remove_event_listener(&dispatch->tablet_mode.other.listener);
1130 &dispatch->lid.paired_keyboard_list,
1140 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
1146 dispatch->lid.is_closed = libevdev_get_event_value(evdev,
1149 dispatch->lid.is_closed_client_state = false;
1158 if (dispatch->lid.is_closed &&
1159 dispatch->lid.reliability == RELIABILITY_RELIABLE) {
1160 fallback_lid_notify_toggle(dispatch, device, time);
1164 if (dispatch->tablet_mode.sw.state) {
1178 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
1187 dispatch->arbitration.rect = rect;
1197 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
1201 if (which == dispatch->arbitration.state)
1213 libinput_timer_set(&dispatch->arbitration.arbitration_timer,
1220 cancel_touches(dispatch, device, &rect, time);
1221 dispatch->arbitration.rect = rect;
1225 libinput_timer_cancel(&dispatch->arbitration.arbitration_timer);
1226 fallback_return_to_neutral_state(dispatch, device);
1227 dispatch->arbitration.in_arbitration = true;
1234 dispatch->arbitration.state = which;
1240 struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch);
1242 libinput_timer_destroy(&dispatch->wheel.scroll_timer);
1243 libinput_timer_destroy(&dispatch->arbitration.arbitration_timer);
1244 libinput_timer_destroy(&dispatch->debounce.timer);
1245 libinput_timer_destroy(&dispatch->debounce.timer_short);
1247 free(dispatch->mt.slots);
1248 free(dispatch);
1255 struct fallback_dispatch *dispatch =
1256 fallback_dispatch(lid_switch->dispatch);
1267 list_for_each(kbd, &dispatch->lid.paired_keyboard_list, link) {
1279 list_insert(&dispatch->lid.paired_keyboard_list, &kbd->link);
1287 if (dispatch->lid.is_closed)
1288 fallback_lid_toggle_keyboard_listener(dispatch,
1290 dispatch->lid.is_closed);
1294 fallback_resume(struct fallback_dispatch *dispatch,
1297 if (dispatch->base.sendevents.current_mode ==
1305 fallback_suspend(struct fallback_dispatch *dispatch,
1316 struct fallback_dispatch *dispatch = data;
1317 struct evdev_device *device = dispatch->device;
1330 fallback_resume(dispatch, device);
1334 fallback_suspend(dispatch, device);
1344 struct fallback_dispatch *dispatch =
1345 fallback_dispatch(keyboard->dispatch);
1366 if (dispatch->tablet_mode.other.sw_device)
1375 &dispatch->tablet_mode.other.listener,
1377 dispatch);
1378 dispatch->tablet_mode.other.sw_device = tablet_mode_switch;
1384 fallback_suspend(dispatch, keyboard);
1400 struct fallback_dispatch *dispatch =
1401 fallback_dispatch(device->dispatch);
1405 &dispatch->lid.paired_keyboard_list,
1416 if (removed_device == dispatch->tablet_mode.other.sw_device) {
1418 &dispatch->tablet_mode.other.listener);
1420 &dispatch->tablet_mode.other.listener);
1421 dispatch->tablet_mode.other.sw_device = NULL;
1443 struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch);
1448 if (fallback_any_button_down(dispatch, device))
1457 struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch);
1464 if (fallback_any_button_down(dispatch, device))
1485 struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch);
1487 dispatch->rotation.angle = degrees_cw;
1488 matrix_init_rotate(&dispatch->rotation.matrix, degrees_cw);
1497 struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch);
1499 return dispatch->rotation.angle;
1509 fallback_init_rotation(struct fallback_dispatch *dispatch,
1515 dispatch->rotation.config.is_available = fallback_rotation_config_is_available;
1516 dispatch->rotation.config.set_angle = fallback_rotation_config_set_angle;
1517 dispatch->rotation.config.get_angle = fallback_rotation_config_get_angle;
1518 dispatch->rotation.config.get_default_angle = fallback_rotation_config_get_default_angle;
1519 matrix_init_identity(&dispatch->rotation.matrix);
1520 device->base.config.rotation = &dispatch->rotation.config;
1524 fallback_dispatch_init_slots(struct fallback_dispatch *dispatch,
1570 dispatch->mt.slots = slots;
1571 dispatch->mt.slots_len = num_slots;
1572 dispatch->mt.slot = active_slot;
1573 dispatch->mt.has_palm = libevdev_has_event_code(evdev,
1578 dispatch->mt.want_hysteresis = true;
1579 dispatch->mt.hysteresis_margin.x = device->abs.absinfo_x->fuzz/2;
1580 dispatch->mt.hysteresis_margin.y = device->abs.absinfo_y->fuzz/2;
1587 fallback_dispatch_init_rel(struct fallback_dispatch *dispatch,
1590 dispatch->rel.x = 0;
1591 dispatch->rel.y = 0;
1595 fallback_dispatch_init_abs(struct fallback_dispatch *dispatch,
1601 dispatch->abs.point.x = device->abs.absinfo_x->value;
1602 dispatch->abs.point.y = device->abs.absinfo_y->value;
1603 dispatch->abs.seat_slot = -1;
1609 fallback_dispatch_init_switch(struct fallback_dispatch *dispatch,
1614 list_init(&dispatch->lid.paired_keyboard_list);
1617 dispatch->lid.reliability = evdev_read_switch_reliability_prop(device);
1618 dispatch->lid.is_closed = false;
1625 dispatch->tablet_mode.sw.state = val;
1628 libinput_device_init_event_listener(&dispatch->tablet_mode.other.listener);
1634 struct fallback_dispatch *dispatch = data;
1636 if (dispatch->arbitration.in_arbitration)
1637 dispatch->arbitration.in_arbitration = false;
1639 evdev_log_debug(dispatch->device, "touch arbitration timeout\n");
1643 fallback_init_arbitration(struct fallback_dispatch *dispatch,
1652 libinput_timer_init(&dispatch->arbitration.arbitration_timer,
1656 dispatch);
1657 dispatch->arbitration.in_arbitration = false;
1664 struct fallback_dispatch *dispatch;
1666 dispatch = zalloc(sizeof *dispatch);
1667 dispatch->device = evdev_device(libinput_device);
1668 dispatch->base.dispatch_type = DISPATCH_FALLBACK;
1669 dispatch->base.interface = &fallback_interface;
1670 dispatch->pending_event = EVDEV_NONE;
1671 list_init(&dispatch->lid.paired_keyboard_list);
1673 fallback_dispatch_init_rel(dispatch, device);
1674 fallback_dispatch_init_abs(dispatch, device);
1675 if (fallback_dispatch_init_slots(dispatch, device) == -1) {
1676 free(dispatch);
1680 fallback_dispatch_init_switch(dispatch, device);
1693 evdev_init_calibration(device, &dispatch->calibration);
1694 evdev_init_sendevents(device, &dispatch->base);
1695 fallback_init_rotation(dispatch, device);
1715 fallback_init_wheel(dispatch, device);
1716 fallback_init_debounce(dispatch);
1717 fallback_init_arbitration(dispatch, device);
1719 return &dispatch->base;