mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-06 01:40:45 -05:00
opt: center pos when no pos rule hit
This commit is contained in:
parent
51b3034bb2
commit
fbc0ecfe01
1 changed files with 10 additions and 1 deletions
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;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue