fix: fix offset caculate for out clip

This commit is contained in:
DreamMaoMao 2025-06-22 22:32:53 +08:00
parent bff64274e4
commit f3c33899bd

View file

@ -1212,27 +1212,28 @@ struct ivec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
return offset; return offset;
int bottom_out_offset = int bottom_out_offset =
GEZERO(c->animation.current.y - c->animation.current.height - GEZERO(c->animation.current.y + c->animation.current.height -
c->mon->m.y - c->mon->m.height); c->mon->m.y - c->mon->m.height);
int right_out_offset = int right_out_offset =
GEZERO(c->animation.current.x + c->animation.current.width - GEZERO(c->animation.current.x + c->animation.current.width -
c->mon->m.x - c->mon->m.width); c->mon->m.x - c->mon->m.width);
int left_out_offset = GEZERO(c->mon->m.x - c->animation.current.x);
int top_out_offset = GEZERO(c->mon->m.y - c->animation.current.y);
int bw = (int)c->bw;
// // make tagout tagin animations not visible in other monitors // // make tagout tagin animations not visible in other monitors
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted || if (ISTILED(c) || c->animation.tagining || c->animation.tagouted ||
c->animation.tagouting) { c->animation.tagouting) {
if (c->animation.current.x < c->mon->m.x) { if (left_out_offset > 0) {
offsetx = c->mon->m.x - c->bw - c->animation.current.x; offsetx = GEZERO(left_out_offset - bw);
offsetx = offsetx < 0 ? 0 : offsetx;
clip_box->x = clip_box->x + offsetx; clip_box->x = clip_box->x + offsetx;
clip_box->width = clip_box->width - offsetx; clip_box->width = clip_box->width - offsetx;
} else if (right_out_offset > 0) { } else if (right_out_offset > 0) {
clip_box->width = clip_box->width - right_out_offset; clip_box->width = clip_box->width - right_out_offset;
} }
if (c->animation.current.y < c->mon->m.y) { if (top_out_offset > 0) {
offsety = c->mon->m.y - c->bw - c->animation.current.y; offsety = GEZERO(top_out_offset - bw);
offsety = offsety < 0 ? 0 : offsety;
clip_box->y = clip_box->y + offsety; clip_box->y = clip_box->y + offsety;
clip_box->height = clip_box->height - offsety; clip_box->height = clip_box->height - offsety;
} else if (bottom_out_offset > 0) { } else if (bottom_out_offset > 0) {