diff --git a/src/client/client.h b/src/client/client.h index 2436bd9..90be17e 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -341,6 +341,21 @@ static inline void client_set_minimized(Client *c, bool minimized) { return; } +static inline void client_set_maximized(Client *c, bool maximized) { + struct wlr_xdg_toplevel *toplevel; + +#ifdef XWAYLAND + if (client_is_x11(c)) { + wlr_xwayland_surface_set_maximized(c->surface.xwayland, maximized, + maximized); + return; + } +#endif + toplevel = c->surface.xdg->toplevel; + wlr_xdg_toplevel_set_maximized(toplevel, maximized); + return; +} + static inline void client_set_tiled(Client *c, uint32_t edges) { struct wlr_xdg_toplevel *toplevel; #ifdef XWAYLAND @@ -359,7 +374,7 @@ static inline void client_set_tiled(Client *c, uint32_t edges) { wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges); } - if (!c->ignore_maximize) { + if (!c->ignore_maximize && c->force_maximize) { wlr_xdg_toplevel_set_maximized(toplevel, edges != WLR_EDGE_NONE); } } diff --git a/src/config/parse_config.h b/src/config/parse_config.h index d6a8c37..ddd5fa7 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -72,6 +72,7 @@ typedef struct { int no_force_center; int isterm; int allow_csd; + int force_maximize; int noswallow; int noblur; float focused_opacity; @@ -1546,6 +1547,7 @@ void parse_option(Config *config, char *key, char *value) { rule->isnosizehint = -1; rule->isterm = -1; rule->allow_csd = -1; + rule->force_maximize = -1; rule->noswallow = -1; rule->noblur = -1; rule->nofadein = -1; @@ -1640,6 +1642,8 @@ void parse_option(Config *config, char *key, char *value) { rule->isterm = atoi(val); } else if (strcmp(key, "allow_csd") == 0) { rule->allow_csd = atoi(val); + } else if (strcmp(key, "force_maximize") == 0) { + rule->force_maximize = atoi(val); } else if (strcmp(key, "noswallow") == 0) { rule->noswallow = atoi(val); } else if (strcmp(key, "noblur") == 0) { diff --git a/src/mango.c b/src/mango.c index e84fe16..76005a1 100644 --- a/src/mango.c +++ b/src/mango.c @@ -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; @@ -1130,6 +1131,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); @@ -3521,6 +3523,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 @@ -3540,7 +3543,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)) { @@ -4126,9 +4130,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); } } @@ -4470,6 +4475,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); }