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W6PULFUP5JZUGWWNUSAC UYJJ4ITZ7ZRLV3DM2JIJLTNLNBGUNFXBRGEFORY2EMQU35NBLEBQC MJZ6RCUUOK7R2RMXPXMLRWBAEM6234D2IS7RGPHAE5UN2S64GLGAC ZMBRCWTSPFDT2LXTUIZHN6PCC6WR53Z7DLKEC6ICZZLHTW3PU6EQC EQRGODLKSVSPFSUZU7BV5ER72U4QS4ATSBKV544XXQVKKTOSC7EAC 5NXELRTS2KF2SZJRXZBJNNDXZG23OSWVUVCIQSPV7TH7T3XKL4PAC YCC55JJHQR3BEO3ZTP6NVDKTFU4NNNJP2SW755QMMUAIEBMXXIRAC SD5WQI5HDQYZKW67M2QOHKLEDL23WIQN22MAABS2ORQDLIJS5GWQC 3ZTG6CX4LPFTAV4AKALPCMGUCEA3XDE3O4LVTCBAQJDTBYO5ABCAC HSAZJTBIAQFXHRMPSE6VZXIJFJTHG2LWAIPKIOER2NKCEMFHQMOQC VCNLR5X75OAXVKPZQHF5RUZ7BONBUC6RPGO2NZEUD3FZ7TEVL66AC ZPSXARCBIT2LZ4PLNMKXHIEEWG3XLVXXISIZDYNGFACDI5I256NQC }voidcreatepointerconstraint(struct wl_listener *listener, void *data){PointerConstraint *pointer_constraint = ecalloc(1, sizeof(*pointer_constraint));pointer_constraint->constraint = data;LISTEN(&pointer_constraint->constraint->events.destroy,&pointer_constraint->destroy, destroypointerconstraint);}voidcursorconstrain(struct wlr_pointer_constraint_v1 *constraint){if (active_constraint == constraint)return;if (active_constraint)wlr_pointer_constraint_v1_send_deactivated(active_constraint);active_constraint = constraint;wlr_pointer_constraint_v1_send_activated(constraint);
}voidcursorwarptohint(void){Client *c = NULL;double sx = active_constraint->current.cursor_hint.x;double sy = active_constraint->current.cursor_hint.y;toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);/* TODO: wlroots 0.18: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4478 */if (c && (active_constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT )) {wlr_cursor_warp(cursor, NULL, sx + c->geom.x + c->bw, sy + c->geom.y + c->bw);wlr_seat_pointer_warp(active_constraint->seat, sx, sy);}
destroypointerconstraint(struct wl_listener *listener, void *data){PointerConstraint *pointer_constraint = wl_container_of(listener, pointer_constraint, destroy);if (active_constraint == pointer_constraint->constraint) {cursorwarptohint();active_constraint = NULL;}wl_list_remove(&pointer_constraint->destroy.link);free(pointer_constraint);}void
wlr_cursor_warp_absolute(cursor, &event->pointer->base, event->x, event->y);motionnotify(event->time_msec);
double lx, ly, dx, dy;wlr_cursor_absolute_to_layout_coords(cursor, &event->pointer->base, event->x, event->y, &lx, &ly);dx = lx - cursor->x;dy = ly - cursor->y;motionnotify(event->time_msec, &event->pointer->base, dx, dy, dx, dy);
wlr_relative_pointer_manager_v1_send_relative_motion(relative_pointer_mgr, seat, (uint64_t)time * 1000,dx, dy, dx_unaccel, dy_unaccel);wl_list_for_each(constraint, &pointer_constraints->constraints, link)cursorconstrain(constraint);if (active_constraint && cursor_mode != CurResize && cursor_mode != CurMove) {toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);if (c && active_constraint->surface == seat->pointer_state.focused_surface) {sx = cursor->x - c->geom.x - c->bw;sy = cursor->y - c->geom.y - c->bw;if (wlr_region_confine(&active_constraint->region, sx, sy,sx + dx, sy + dy, &sx_confined, &sy_confined)) {dx = sx_confined - sx;dy = sy_confined - sy;}if (active_constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED)return;}}wlr_cursor_move(cursor, device, dx, dy);
dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h