From 73750ecea61ee2871b7e97671a0b10dcadf09abd Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 13 May 2025 09:20:24 +0800 Subject: [PATCH] opt: Respect the position prompt of the x11 pop-up window --- src/maomao.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/maomao.c b/src/maomao.c index b5d0e06..f6db240 100644 --- a/src/maomao.c +++ b/src/maomao.c @@ -1747,7 +1747,8 @@ 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; // 重新计算居中的坐标 - c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety); + 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 : 0; @@ -1809,7 +1810,8 @@ 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; // 重新计算居中的坐标 - c->geom = setclient_coordinate_center(c->geom, r->offsetx, r->offsety); + 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); } } } @@ -5297,7 +5299,8 @@ setfloating(Client *c, int floating) { target_box.width = target_box.width * 0.8; } // 重新计算居中的坐标 - target_box = setclient_coordinate_center(target_box, 0, 0); + if(!client_is_x11(c)) + target_box = setclient_coordinate_center(target_box, 0, 0); backup_box = c->geom; hit = applyrulesgeom(c); target_box = hit == 1 ? c->geom : target_box;