Lines Matching defs:mt
698 struct mt_state *mt = &input->mt;
702 if (slot < 0 || slot >= mt->num_slots)
706 mt->frame |= bit;
708 mts = &mt->slots[slot];
710 set_x(&mts->pos, x, mt->sync + MTS_X, bit);
711 set_y(&mts->pos, y, mt->sync + MTS_Y, bit);
714 if ((mt->touches & bit) == (mt->sync[MTS_TOUCH] & bit))
720 mt->sync[MTS_PRESSURE] |= bit;
723 if ((mt->touches & bit) == 0) {
724 mt->num_touches++;
725 mt->touches |= bit;
726 mt->sync[MTS_TOUCH] |= bit;
728 mt->sync[MTS_X] |= bit;
729 mt->sync[MTS_Y] |= bit;
731 } else if (mt->touches & bit) {
732 mt->num_touches--;
733 mt->touches ^= bit;
734 mt->sync[MTS_TOUCH] |= bit;
735 mt->ptr_mask &= mt->touches;
747 if (aux < 0 || aux >= input->mt.num_slots)
749 mts = &input->mt.slots[aux];
842 if (input->mt.frame & ~input->mt.touches) {
844 input->mt.sync[i] &= input->mt.touches;
872 struct mt_state *mt = &input->mt;
876 mt->prev_ptr = mt->ptr;
878 if (mt->num_touches <= 1) {
879 mt->ptr = mt->touches;
880 mt->ptr_cycle = mt->ptr;
884 updates = (mt->sync[MTS_X] | mt->sync[MTS_Y]) & ~mt->sync[MTS_TOUCH];
891 if (wsmouse_hysteresis(input, &mt->slots[slot].pos))
899 select = ((mt->ptr & mt->touches & ~mt->ptr_mask) == 0);
902 mt->ptr_cycle &= ~(mt->frame ^ updates);
904 if (mt->ptr_cycle & updates) {
905 select |= ((mt->ptr_cycle & mt->ptr) == 0);
906 mt->ptr_cycle = updates;
908 mt->ptr_cycle |= updates;
911 if (mt->ptr_cycle & ~mt->ptr_mask)
912 slot = ffs(mt->ptr_cycle & ~mt->ptr_mask) - 1;
913 else if (mt->touches & ~mt->ptr_mask)
914 slot = ffs(mt->touches & ~mt->ptr_mask) - 1;
916 slot = ffs(mt->touches) - 1;
917 mt->ptr = (1 << slot);
926 struct mt_state *mt = &input->mt;
932 if (mt->ptr) {
933 slot = ffs(mt->ptr) - 1;
934 mts = &mt->slots[slot];
939 if (mt->ptr != mt->prev_ptr)
949 wsmouse_touch(sc, pressure, mt->num_touches);
1075 mt_sync = (input->mt.frame && (input->mt.sync[MTS_TOUCH]
1076 || input->mt.ptr != input->mt.prev_ptr));
1089 printf(" mt:0x%02x:%d", input->mt.touches,
1090 ffs(input->mt.ptr) - 1);
1125 if (input->mt.frame) {
1126 input->mt.frame = 0;
1128 input->mt.sync[i] = 0;
1150 if (input->mt.frame) {
1199 struct mt_state *mt = &input->mt;
1202 if (mt->num_slots == 0)
1205 FOREACHBIT(mt->touches, slot) {
1206 if (mt->slots[slot].id == id)
1209 slot = ffs(~(mt->touches | mt->frame)) - 1;
1210 if (slot >= 0 && slot < mt->num_slots) {
1211 mt->frame |= 1 << slot;
1212 mt->slots[slot].id = id;
1316 struct mt_state *mt = &input->mt;
1321 if (mt->num_slots == 0 || mt->matrix == NULL)
1324 size = imax(0, imin(size, mt->num_slots));
1325 p = mt->matrix;
1326 touches = mt->touches;
1327 if (mt->num_touches >= size) {
1330 dx = pt[i].x - mt->slots[slot].pos.x;
1331 dy = pt[i].y - mt->slots[slot].pos.y;
1334 m = mt->num_touches;
1339 dx = pt[i].x - mt->slots[slot].pos.x;
1340 dy = pt[i].y - mt->slots[slot].pos.y;
1344 n = mt->num_touches;
1346 wsmouse_matching(mt->matrix, m, n, p);
1352 for (i = 0, p = mt->matrix; i < m; i++, p += n)
1363 slot = ffs(~(mt->touches | mt->frame)) - 1;
1364 if (slot < 0 || slot >= mt->num_slots)
1387 if ((n = input->mt.num_slots)) {
1391 input->mt.num_slots = 0;
1392 free(input->mt.slots, M_DEVBUF, size);
1393 input->mt.slots = NULL;
1394 input->mt.matrix = NULL;
1405 if (num_slots == input->mt.num_slots
1420 input->mt.slots = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
1421 if (input->mt.slots != NULL) {
1423 input->mt.matrix = (int *)
1424 (input->mt.slots + n);
1425 input->mt.num_slots = n;
1687 if ((num_slots = input->mt.num_slots)) {
1688 slots = input->mt.slots;
1689 matrix = input->mt.matrix;
1690 memset(&input->mt, 0, sizeof(struct mt_state));
1692 input->mt.num_slots = num_slots;
1693 input->mt.slots = slots;
1694 input->mt.matrix = matrix;