fix: isfloating rule not follow monitor rule
This commit is contained in:
@@ -740,7 +740,7 @@ int32_t centerwin(const Arg *arg) {
|
||||
return 0;
|
||||
|
||||
if (c->isfloating) {
|
||||
c->float_geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->float_geom = setclient_coordinate_center(c, c->mon, c->geom, 0, 0);
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->float_geom, 1);
|
||||
return 0;
|
||||
@@ -1055,7 +1055,7 @@ int32_t tagmon(const Arg *arg) {
|
||||
c->float_geom.height =
|
||||
(int32_t)(c->float_geom.height * c->mon->w.height / selmon->w.height);
|
||||
selmon = c->mon;
|
||||
c->float_geom = setclient_coordinate_center(c, c->float_geom, 0, 0);
|
||||
c->float_geom = setclient_coordinate_center(c, c->mon, c->float_geom, 0, 0);
|
||||
|
||||
// 重新计算居中的坐标
|
||||
// 重新计算居中的坐标
|
||||
|
||||
@@ -74,12 +74,12 @@ Client *get_client_by_id_or_title(const char *arg_id, const char *arg_title) {
|
||||
return target_client;
|
||||
}
|
||||
struct wlr_box // 计算客户端居中坐标
|
||||
setclient_coordinate_center(Client *c, struct wlr_box geom, int32_t offsetx,
|
||||
int32_t offsety) {
|
||||
setclient_coordinate_center(Client *c, Monitor *tm, struct wlr_box geom,
|
||||
int32_t offsetx, int32_t offsety) {
|
||||
struct wlr_box tempbox;
|
||||
int32_t offset = 0;
|
||||
int32_t len = 0;
|
||||
Monitor *m = c->mon ? c->mon : selmon;
|
||||
Monitor *m = tm ? tm : selmon;
|
||||
|
||||
uint32_t cbw = check_hit_no_border(c) ? c->bw : 0;
|
||||
|
||||
|
||||
20
src/mango.c
20
src/mango.c
@@ -689,7 +689,7 @@ static void show_scratchpad(Client *c);
|
||||
static void show_hide_client(Client *c);
|
||||
static void tag_client(const Arg *arg, Client *target_client);
|
||||
|
||||
static struct wlr_box setclient_coordinate_center(Client *c,
|
||||
static struct wlr_box setclient_coordinate_center(Client *c, Monitor *m,
|
||||
struct wlr_box geom,
|
||||
int32_t offsetx,
|
||||
int32_t offsety);
|
||||
@@ -952,7 +952,8 @@ void client_change_mon(Client *c, Monitor *m) {
|
||||
setmon(c, m, c->tags, true);
|
||||
reset_foreign_tolevel(c);
|
||||
if (c->isfloating) {
|
||||
c->float_geom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->float_geom = c->geom =
|
||||
setclient_coordinate_center(c, c->mon, c->geom, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1019,7 +1020,7 @@ void show_scratchpad(Client *c) {
|
||||
: c->mon->w.height * scratchpad_height_ratio;
|
||||
// 重新计算居中的坐标
|
||||
c->float_geom = c->geom = c->animainit_geom = c->animation.current =
|
||||
setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
setclient_coordinate_center(c, c->mon, c->geom, 0, 0);
|
||||
c->iscustomsize = 1;
|
||||
resize(c, c->geom, 0);
|
||||
}
|
||||
@@ -1089,7 +1090,8 @@ bool switch_scratchpad_client_state(Client *c) {
|
||||
c->float_geom.height = (int32_t)(c->float_geom.height *
|
||||
c->mon->w.height / oldmon->w.height);
|
||||
|
||||
c->float_geom = setclient_coordinate_center(c, c->float_geom, 0, 0);
|
||||
c->float_geom =
|
||||
setclient_coordinate_center(c, c->mon, c->float_geom, 0, 0);
|
||||
|
||||
// 只有显示状态的scratchpad才需要聚焦和返回true
|
||||
if (c->is_scratchpad_show) {
|
||||
@@ -1345,7 +1347,7 @@ void applyrules(Client *c) {
|
||||
if (r->offsetx || r->offsety) {
|
||||
c->iscustompos = 1;
|
||||
c->float_geom = c->geom = setclient_coordinate_center(
|
||||
c, c->float_geom, r->offsetx, r->offsety);
|
||||
c, mon, c->float_geom, r->offsetx, r->offsety);
|
||||
}
|
||||
if (c->isfloating) {
|
||||
c->geom = c->float_geom.width > 0 && c->float_geom.height > 0
|
||||
@@ -1363,7 +1365,8 @@ void applyrules(Client *c) {
|
||||
// the hit size
|
||||
if (!c->iscustompos &&
|
||||
(!client_is_x11(c) || (c->geom.x == 0 && c->geom.y == 0))) {
|
||||
c->float_geom = c->geom = setclient_coordinate_center(c, c->geom, 0, 0);
|
||||
c->float_geom = c->geom =
|
||||
setclient_coordinate_center(c, mon, c->geom, 0, 0);
|
||||
} else {
|
||||
c->float_geom = c->geom;
|
||||
}
|
||||
@@ -4537,7 +4540,8 @@ setfloating(Client *c, int32_t floating) {
|
||||
|
||||
// 重新计算居中的坐标
|
||||
if (!client_is_x11(c) && !c->iscustompos)
|
||||
target_box = setclient_coordinate_center(c, target_box, 0, 0);
|
||||
target_box =
|
||||
setclient_coordinate_center(c, c->mon, target_box, 0, 0);
|
||||
else
|
||||
target_box = c->geom;
|
||||
|
||||
@@ -4553,7 +4557,7 @@ setfloating(Client *c, int32_t floating) {
|
||||
}
|
||||
if (window_size_outofrange) {
|
||||
c->float_geom =
|
||||
setclient_coordinate_center(c, c->float_geom, 0, 0);
|
||||
setclient_coordinate_center(c, c->mon, c->float_geom, 0, 0);
|
||||
}
|
||||
resize(c, c->float_geom, 0);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user