From 7f4c62ffe4ec198dfc89e807289900bc7a812402 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 13 May 2025 12:57:13 +0800 Subject: [PATCH] opt: wayland floating client still center pos when open --- src/maomao.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/maomao.c b/src/maomao.c index ce18181..325e6c6 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -1747,7 +1747,7 @@ applyrulesgeom(Client *c) { c->geom.width = r->width > 0 ? r->width : c->geom.width; c->geom.height = r->height > 0 ? r->height : c->geom.height; // 重新计算居中的坐标 - if(r->offsetx || r->offsety || (client_is_x11(c) && client_surface_wants_focus(c))) + if(r->offsetx || r->offsety || (!client_is_x11(c) || client_surface_wants_focus(c))) c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety); hit = r->height > 0 || r->width > 0 || r->offsetx != 0 || r->offsety != 0 ? 1 @@ -1810,7 +1810,7 @@ applyrules(Client *c) { c->geom.width = r->width > 0 ? r->width : c->geom.width; c->geom.height = r->height > 0 ? r->height : c->geom.height; // 重新计算居中的坐标 - if(r->offsetx || r->offsety || (client_is_x11(c) && client_surface_wants_focus(c))) + if(r->offsetx || r->offsety || (!client_is_x11(c) || client_surface_wants_focus(c))) c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety); } } @@ -5306,7 +5306,7 @@ setfloating(Client *c, int floating) { target_box.width = target_box.width * 0.8; } // 重新计算居中的坐标 - if(client_is_x11(c) && client_surface_wants_focus(c)) + if(!client_is_x11(c) || client_surface_wants_focus(c)) target_box = setclient_coordinate_center(target_box, 0, 0); backup_box = c->geom; hit = applyrulesgeom(c);