Lines Matching full:barrier
84 struct PointerBarrier barrier; member
86 /* num_devices/device_ids are devices the barrier applies to */
144 barrier_is_horizontal(const struct PointerBarrier *barrier) in barrier_is_horizontal() argument
146 return barrier->y1 == barrier->y2; in barrier_is_horizontal()
150 barrier_is_vertical(const struct PointerBarrier *barrier) in barrier_is_vertical() argument
152 return barrier->x1 == barrier->x2; in barrier_is_vertical()
156 * @return The set of barrier movement directions the movement vector
178 * Test if the barrier may block movement in the direction defined by
180 * blocked, it does not test if the barrier actually blocks the movement.
182 * @return TRUE if the barrier blocks the direction of movement or FALSE
186 barrier_is_blocking_direction(const struct PointerBarrier * barrier, in barrier_is_blocking_direction() argument
190 return (barrier->directions & direction) != direction; in barrier_is_blocking_direction()
211 * barrier. A movement vector with the startpoint or endpoint adjacent to
212 * the barrier itself counts as intersecting.
219 * intersection with the barrier (if applicable).
220 * @return TRUE if the barrier intersects with the given vector
223 barrier_is_blocking(const struct PointerBarrier * barrier, in barrier_is_blocking() argument
226 if (barrier_is_vertical(barrier)) { in barrier_is_blocking()
228 t = T(barrier->x1, x1, x2); in barrier_is_blocking()
232 /* Edge case: moving away from barrier. */ in barrier_is_blocking()
237 if (!inside_segment(y, barrier->y1, barrier->y2)) in barrier_is_blocking()
240 *distance = sqrt((pow(y - y1, 2) + pow(barrier->x1 - x1, 2))); in barrier_is_blocking()
245 t = T(barrier->y1, y1, y2); in barrier_is_blocking()
249 /* Edge case: moving away from barrier. */ in barrier_is_blocking()
254 if (!inside_segment(x, barrier->x1, barrier->x2)) in barrier_is_blocking()
257 *distance = sqrt((pow(x - x1, 2) + pow(barrier->y1 - y1, 2))); in barrier_is_blocking()
264 barrier_inside_hit_box(struct PointerBarrier *barrier, int x, int y) in barrier_inside_hit_box() argument
269 x1 = barrier->x1; in barrier_inside_hit_box()
270 x2 = barrier->x2; in barrier_inside_hit_box()
271 y1 = barrier->y1; in barrier_inside_hit_box()
272 y2 = barrier->y2; in barrier_inside_hit_box()
273 dir = ~(barrier->directions); in barrier_inside_hit_box()
275 if (barrier_is_vertical(barrier)) { in barrier_inside_hit_box()
281 if (barrier_is_horizontal(barrier)) { in barrier_inside_hit_box()
317 * Find the nearest barrier client that is blocking movement from x1/y1 to x2/y2.
324 * @return The barrier nearest to the movement origin that blocks this movement.
335 struct PointerBarrier *b = &c->barrier; in barrier_find_nearest()
361 * Clamp to the given barrier given the movement direction specified in dir.
363 * @param barrier The barrier to clamp to
369 barrier_clamp_to_barrier(struct PointerBarrier *barrier, int dir, int *x, in barrier_clamp_to_barrier() argument
372 if (barrier_is_vertical(barrier)) { in barrier_clamp_to_barrier()
373 if ((dir & BarrierNegativeX) & ~barrier->directions) in barrier_clamp_to_barrier()
374 *x = barrier->x1; in barrier_clamp_to_barrier()
375 if ((dir & BarrierPositiveX) & ~barrier->directions) in barrier_clamp_to_barrier()
376 *x = barrier->x1 - 1; in barrier_clamp_to_barrier()
378 if (barrier_is_horizontal(barrier)) { in barrier_clamp_to_barrier()
379 if ((dir & BarrierNegativeY) & ~barrier->directions) in barrier_clamp_to_barrier()
380 *y = barrier->y1; in barrier_clamp_to_barrier()
381 if ((dir & BarrierPositiveY) & ~barrier->directions) in barrier_clamp_to_barrier()
382 *y = barrier->y1 - 1; in barrier_clamp_to_barrier()
429 * Given the origin and the movement vector, get the nearest barrier in input_constrain_cursor()
431 * Clamp to that barrier. in input_constrain_cursor()
433 * destination, again finding the nearest barrier and clamping. in input_constrain_cursor()
445 nearest = &c->barrier; in input_constrain_cursor()
492 if (barrier_inside_hit_box(&c->barrier, x, y)) in input_constrain_cursor()
619 ret->id = stuff->barrier; in CreatePointerBarrierClient()
620 ret->barrier.x1 = stuff->x1; in CreatePointerBarrierClient()
621 ret->barrier.x2 = stuff->x2; in CreatePointerBarrierClient()
622 ret->barrier.y1 = stuff->y1; in CreatePointerBarrierClient()
623 ret->barrier.y2 = stuff->y2; in CreatePointerBarrierClient()
624 sort_min_max(&ret->barrier.x1, &ret->barrier.x2); in CreatePointerBarrierClient()
625 sort_min_max(&ret->barrier.y1, &ret->barrier.y2); in CreatePointerBarrierClient()
626 ret->barrier.directions = stuff->directions & 0x0f; in CreatePointerBarrierClient()
627 if (barrier_is_horizontal(&ret->barrier)) in CreatePointerBarrierClient()
628 ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX); in CreatePointerBarrierClient()
629 if (barrier_is_vertical(&ret->barrier)) in CreatePointerBarrierClient()
630 ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY); in CreatePointerBarrierClient()
652 c = container_of(data, struct PointerBarrierClient, barrier); in BarrierFreeBarrier()
707 struct PointerBarrierClient *barrier; in add_master_func() local
712 barrier = container_of(b, struct PointerBarrierClient, barrier); in add_master_func()
719 xorg_list_add(&pbd->entry, &barrier->per_device); in add_master_func()
726 struct PointerBarrierClient *barrier; in remove_master_func() local
738 barrier = container_of(b, struct PointerBarrierClient, barrier); in remove_master_func()
740 pbd = GetBarrierDevice(barrier, *deviceid); in remove_master_func()
752 .root = barrier->screen->root->drawable.id, in remove_master_func()
753 .window = barrier->window, in remove_master_func()
757 .barrierid = barrier->id, in remove_master_func()
784 struct PointerBarrierClient *barrier; in XICreatePointerBarrier() local
806 if ((err = CreatePointerBarrierClient(client, stuff, &barrier))) in XICreatePointerBarrier()
809 if (!AddResource(stuff->barrier, PointerBarrierType, &barrier->barrier)) in XICreatePointerBarrier()
820 void *barrier; in XIDestroyPointerBarrier() local
822 err = dixLookupResourceByType((void **) &barrier, stuff->barrier, in XIDestroyPointerBarrier()
825 client->errorValue = stuff->barrier; in XIDestroyPointerBarrier()
829 if (CLIENT_ID(stuff->barrier) != client->index) in XIDestroyPointerBarrier()
832 FreeResource(stuff->barrier, RT_NONE); in XIDestroyPointerBarrier()
854 swapl(&info->barrier); in SProcXIBarrierReleasePointer()
866 struct PointerBarrierClient *barrier; in ProcXIBarrierReleasePointer() local
883 barrier_id = info->barrier; in ProcXIBarrierReleasePointer()
903 barrier = container_of(b, struct PointerBarrierClient, barrier); in ProcXIBarrierReleasePointer()
905 pbd = GetBarrierDevice(barrier, dev->id); in ProcXIBarrierReleasePointer()