From afaec57aad8b36835bb5e3794397f0859f611978 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 11 Feb 2025 23:43:43 +0800 Subject: [PATCH] =?UTF-8?q?tagout=20tagin=20=E5=8A=A8=E7=94=BB=E5=89=AA?= =?UTF-8?q?=E5=88=87border?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sdfs sfs --- main.c | 74 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/main.c b/main.c index ce2cc147..c4569ca2 100644 --- a/main.c +++ b/main.c @@ -791,16 +791,56 @@ void client_actual_size(Client *c, uint32_t *width, uint32_t *height) { : c->current.height; } -void apply_border(Client *c, struct wlr_box clip_box,int offset) { +void apply_border(Client *c, struct wlr_box clip_box, int offset) +{ + wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw); wlr_scene_rect_set_size(c->border[0], clip_box.width, c->bw); wlr_scene_rect_set_size(c->border[1], clip_box.width, c->bw); - wlr_scene_rect_set_size(c->border[2], c->bw, clip_box.height - 2 * c->bw); - wlr_scene_rect_set_size(c->border[3], c->bw, clip_box.height - 2 * c->bw); - wlr_scene_node_set_position(&c->border[1]->node, 0, clip_box.height - c->bw); - wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); - wlr_scene_node_set_position(&c->border[3]->node, clip_box.width - c->bw, - c->bw); + + if (c->animation.tagining || c->animation.tagouted || c->animation.tagouting) + { + if (c->animation.current.x < c->mon->m.x) + { + wlr_scene_rect_set_size(c->border[2], 0, 0); + wlr_scene_rect_set_size(c->border[3], c->bw, clip_box.height - 2 * c->bw); + wlr_scene_node_set_position(&c->border[0]->node, offset, 0); + wlr_scene_node_set_position(&c->border[2]->node, 0 + offset, c->bw); + wlr_scene_node_set_position(&c->border[1]->node, offset, clip_box.height - c->bw); + wlr_scene_node_set_position(&c->border[3]->node, clip_box.width - c->bw + offset, + c->bw); + } + else if (c->animation.current.x + c->geom.width > c->mon->m.x + c->mon->m.width) + { + wlr_scene_rect_set_size(c->border[2], c->bw, clip_box.height - 2 * c->bw); + wlr_scene_rect_set_size(c->border[3], 0, 0); + wlr_scene_node_set_position(&c->border[0]->node, 0, 0); + wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); + wlr_scene_node_set_position(&c->border[1]->node, 0, clip_box.height - c->bw); + wlr_scene_node_set_position(&c->border[3]->node, clip_box.width - c->bw, + c->bw); + } + else + { + wlr_scene_rect_set_size(c->border[2], c->bw, clip_box.height - 2 * c->bw); + wlr_scene_rect_set_size(c->border[3], c->bw, clip_box.height - 2 * c->bw); + wlr_scene_node_set_position(&c->border[0]->node, 0, 0); + wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); + wlr_scene_node_set_position(&c->border[1]->node, 0, clip_box.height - c->bw); + wlr_scene_node_set_position(&c->border[3]->node, clip_box.width - c->bw, + c->bw); + } + } + else + { + wlr_scene_rect_set_size(c->border[2], c->bw, clip_box.height - 2 * c->bw); + wlr_scene_rect_set_size(c->border[3], c->bw, clip_box.height - 2 * c->bw); + wlr_scene_node_set_position(&c->border[0]->node, 0, 0); + wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); + wlr_scene_node_set_position(&c->border[1]->node, 0, clip_box.height - c->bw); + wlr_scene_node_set_position(&c->border[3]->node, clip_box.width - c->bw, + c->bw); + } } void client_apply_clip(Client *c) { @@ -823,11 +863,12 @@ void client_apply_clip(Client *c) { } // make tagout tagin animations not visible in other monitors - if(c->animation.tagouting || c->animation.tagining) { + if(c->animation.tagouting || c->animation.tagining || c->animation.tagouted) { if (c->animation.current.x <= c->mon->m.x) { offset = c->mon->m.x - c->animation.current.x; clip_box.x = clip_box.x + offset; - } else if(c->animation.current.x + c->animation.current.width >= c->mon->m.x + c->mon->m.width) { + clip_box.width = clip_box.width - offset; + } else if(c->animation.current.x + c->geom.width >= c->mon->m.x + c->mon->m.width) { clip_box.width = clip_box.width - (c->animation.current.x + c->animation.current.width - c->mon->m.x - c->mon->m.width); } } @@ -1189,21 +1230,16 @@ arrange(Monitor *m, bool want_animation) { } c->animation.from_rule = false; - if ((c->isfloating || c->isfullscreen || c->ismaxmizescreen) && - (c->animation.tagouting || c->animation.tagouted)) { - c->animation.tagouting = false; - c->animation.tagouted = false; - resize(c, c->geom, 0); - } else { - c->animation.tagouting = false; - c->animation.tagouted = false; - resize(c, c->geom, 0); - } + c->animation.tagouting = false; + c->animation.tagouted = false; + resize(c, c->geom, 0); + } else { if ((c->tags & (1 << (selmon->pertag->prevtag - 1))) && want_animation && m->pertag->prevtag != 0 && m->pertag->curtag != 0) { c->animation.tagouting = true; + c->animation.tagining = false; if (m->pertag->curtag > m->pertag->prevtag) { c->pending = c->geom; c->pending.x = c->mon->m.x - c->geom.width;