opt: add force_maximize

sf
This commit is contained in:
DreamMaoMao 2025-10-15 22:37:26 +08:00
parent 43798176f3
commit 28bd66d4b0
3 changed files with 33 additions and 3 deletions

View file

@ -325,6 +325,7 @@ struct Client {
struct dwl_animation animation;
int isterm, noswallow;
int allow_csd;
int force_maximize;
pid_t pid;
Client *swallowing, *swallowedby;
bool is_clip_to_hide;
@ -1140,6 +1141,7 @@ void toggle_hotarea(int x_root, int y_root) {
static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
APPLY_INT_PROP(c, r, isterm);
APPLY_INT_PROP(c, r, allow_csd);
APPLY_INT_PROP(c, r, force_maximize);
APPLY_INT_PROP(c, r, noswallow);
APPLY_INT_PROP(c, r, nofadein);
APPLY_INT_PROP(c, r, nofadeout);
@ -3438,6 +3440,7 @@ void init_client_properties(Client *c) {
c->stack_innder_per = 0.0f;
c->isterm = 0;
c->allow_csd = 0;
c->force_maximize = 1;
}
void // old fix to 0.5
@ -3458,7 +3461,8 @@ mapnotify(struct wl_listener *listener, void *data) {
client_get_geometry(c, &c->geom);
init_client_properties(c);
if (client_is_x11(c))
init_client_properties(c);
// set special window properties
if (client_is_unmanaged(c) || client_should_ignore_focus(c)) {
@ -4064,9 +4068,10 @@ void requestdecorationmode(struct wl_listener *listener, void *data) {
// 如果客户端没有指定,使用默认模式
if (!c->allow_csd) {
requested_mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
} else if (requested_mode ==
WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) {
}
// 尊重客户端的请求
wlr_xdg_toplevel_decoration_v1_set_mode(c->decoration, requested_mode);
}
}
@ -4408,6 +4413,12 @@ void setmaxmizescreen(Client *c, int maxmizescreen) {
set_size_per(c->mon, c);
}
if (!c->force_maximize && !c->ismaxmizescreen) {
client_set_maximized(c, false);
} else {
client_set_maximized(c, true);
}
arrange(c->mon, false);
}