mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-31 22:25:29 -04:00
opt: optimize scroll clip offeset
This commit is contained in:
parent
26634f28e4
commit
4a560c1a60
1 changed files with 11 additions and 9 deletions
20
src/maomao.c
20
src/maomao.c
|
|
@ -1178,27 +1178,29 @@ struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||
// // make tagout tagin animations not visible in other monitors
|
||||
if (ISTILED(c) || c->animation.tagining || c->animation.tagouted ||
|
||||
c->animation.tagouting) {
|
||||
if (c->animation.current.x <= c->mon->m.x) {
|
||||
offsetx = GEZERO(c->mon->m.x - c->animation.current.x);
|
||||
if (c->animation.current.x < c->mon->m.x) {
|
||||
offsetx = c->mon->m.x - c->bw - c->animation.current.x;
|
||||
offsetx = offsetx < 0 ? 0 : offsetx;
|
||||
clip_box->x = clip_box->x + offsetx;
|
||||
clip_box->width = clip_box->width - offsetx;
|
||||
} else if (c->animation.current.x + c->animation.current.width >=
|
||||
} else if (c->animation.current.x + c->animation.current.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) -
|
||||
c->mon->m.x - c->mon->m.width) +
|
||||
c->bw;
|
||||
}
|
||||
|
||||
if (c->animation.current.y <= c->mon->m.y) {
|
||||
offsety = GEZERO(c->mon->m.y - c->animation.current.y);
|
||||
if (c->animation.current.y < c->mon->m.y) {
|
||||
offsety = c->mon->m.y - c->bw - c->animation.current.y;
|
||||
offsety = offsety < 0 ? 0 : offsety;
|
||||
clip_box->y = clip_box->y + offsety;
|
||||
clip_box->height = clip_box->height - offsety;
|
||||
} else if (c->animation.current.y + c->animation.current.height >=
|
||||
} else if (c->animation.current.y + c->animation.current.height >
|
||||
c->mon->m.y + c->mon->m.height) {
|
||||
clip_box->height = clip_box->height -
|
||||
(c->animation.current.y + c->animation.current.height -
|
||||
c->mon->m.y - c->mon->m.height) -
|
||||
c->mon->m.y - c->mon->m.height) +
|
||||
c->bw;
|
||||
}
|
||||
}
|
||||
|
|
@ -1206,7 +1208,7 @@ struct uvec2 clip_to_hide(Client *c, struct wlr_box *clip_box) {
|
|||
offset.x = offsetx;
|
||||
offset.y = offsety;
|
||||
|
||||
if ((clip_box->width <= 0 || clip_box->height <= 0) &&
|
||||
if ((clip_box->width < 0 || clip_box->height < 0) &&
|
||||
(ISTILED(c) || c->animation.tagouting || c->animation.tagining)) {
|
||||
c->is_clip_to_hide = true;
|
||||
wlr_scene_node_set_enabled(&c->scene->node, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue