fix: mouse resize and drag error

This commit is contained in:
DreamMaoMao 2025-02-19 17:53:08 +08:00
parent 0c07719e29
commit 5b3f1f904d

View file

@ -881,8 +881,8 @@ void client_apply_clip(Client *c) {
scale_data.height = clip_box.height -2*c->bw; scale_data.height = clip_box.height -2*c->bw;
if(c->animation.running) { if(c->animation.running) {
scale_data.width_scale = (float)clip_box.width/c->geom.width; scale_data.width_scale = (float)clip_box.width/c->current.width;
scale_data.height_scale = (float)clip_box.height/c->geom.height; scale_data.height_scale = (float)clip_box.height/c->current.height;
buffer_set_size(c, scale_data); buffer_set_size(c, scale_data);
} else { } else {
scale_data.width_scale = 1.0; scale_data.width_scale = 1.0;
@ -3652,6 +3652,10 @@ void buffer_set_size(Client *c, animationScale data) {
if(c->iskilling|| c->animation.tagouting || c->animation.tagining || c->animation.tagouted) { if(c->iskilling|| c->animation.tagouting || c->animation.tagining || c->animation.tagouted) {
return; return;
} }
if(c == grabc)
return;
wlr_scene_node_for_each_buffer(&c->scene_surface->node, wlr_scene_node_for_each_buffer(&c->scene_surface->node,
scene_buffer_apply_size, &data); scene_buffer_apply_size, &data);
} }
@ -3905,7 +3909,7 @@ void resize(Client *c, struct wlr_box geo, int interact) {
return; return;
struct wlr_box *bbox; struct wlr_box *bbox;
// struct wlr_box clip; struct wlr_box clip;
if (!c->mon) if (!c->mon)
return; return;
@ -3962,6 +3966,18 @@ void resize(Client *c, struct wlr_box geo, int interact) {
c->configure_serial = c->configure_serial =
client_set_size(c, c->geom.width - 2 * c->bw, c->geom.height - 2 * c->bw); client_set_size(c, c->geom.width - 2 * c->bw, c->geom.height - 2 * c->bw);
if (c == grabc) {
c->animation.running = false;
c->need_set_position = false;
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
apply_border(c,c->geom, 0);
wlr_scene_node_set_position(&c->scene_surface->node, c->bw, c->bw);
client_get_clip(c, &clip);
wlr_scene_subsurface_tree_set_clip(&c->scene_surface->node, &clip);
return;
}
// 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小 // 如果不是工作区切换时划出去的窗口,就让动画的结束位置,就是上面的真实位置和大小
// c->pending 决定动画的终点一般在其他调用resize的函数的附近设置了 // c->pending 决定动画的终点一般在其他调用resize的函数的附近设置了
if (!c->animation.tagouting && !c->iskilling) { if (!c->animation.tagouting && !c->iskilling) {