opt: center pos when no pos rule hit
This commit is contained in:
11
src/maomao.c
11
src/maomao.c
@@ -1817,6 +1817,7 @@ applyrules(Client *c) {
|
|||||||
int ji;
|
int ji;
|
||||||
const ConfigWinRule *r;
|
const ConfigWinRule *r;
|
||||||
Monitor *mon = selmon, *m;
|
Monitor *mon = selmon, *m;
|
||||||
|
bool hit_rule_pos = false;
|
||||||
|
|
||||||
c->isfloating = client_is_float_type(c);
|
c->isfloating = client_is_float_type(c);
|
||||||
if (!(appid = client_get_appid(c)))
|
if (!(appid = client_get_appid(c)))
|
||||||
@@ -1872,13 +1873,21 @@ applyrules(Client *c) {
|
|||||||
c->geom.width = r->width > 0 ? r->width : c->geom.width;
|
c->geom.width = r->width > 0 ? r->width : c->geom.width;
|
||||||
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
c->geom.height = r->height > 0 ? r->height : c->geom.height;
|
||||||
// 重新计算居中的坐标
|
// 重新计算居中的坐标
|
||||||
if (r->offsetx || r->offsety)
|
if (r->offsetx || r->offsety) {
|
||||||
|
hit_rule_pos = true;
|
||||||
c->oldgeom = c->geom =
|
c->oldgeom = c->geom =
|
||||||
setclient_coordinate_center(c, c->geom, r->offsetx, r->offsety);
|
setclient_coordinate_center(c, c->geom, r->offsetx, r->offsety);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if no pos rule hit, use the default pos
|
||||||
|
if(!hit_rule_pos && (!client_is_x11(c) || !client_should_ignore_focus(c))) {
|
||||||
|
c->oldgeom = c->geom =
|
||||||
|
setclient_coordinate_center(c, c->geom, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!client_surface(c)->mapped)
|
if (!client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user