mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-18 06:59:53 -05:00
feat: add allow_csd option to windowrule
This commit is contained in:
parent
767dfc97db
commit
1161fdf2e8
2 changed files with 23 additions and 3 deletions
|
|
@ -71,6 +71,7 @@ typedef struct {
|
||||||
int nofadeout;
|
int nofadeout;
|
||||||
int no_force_center;
|
int no_force_center;
|
||||||
int isterm;
|
int isterm;
|
||||||
|
int allow_csd;
|
||||||
int noswallow;
|
int noswallow;
|
||||||
float focused_opacity;
|
float focused_opacity;
|
||||||
float unfocused_opacity;
|
float unfocused_opacity;
|
||||||
|
|
@ -1481,6 +1482,7 @@ void parse_option(Config *config, char *key, char *value) {
|
||||||
rule->ignore_minimize = -1;
|
rule->ignore_minimize = -1;
|
||||||
rule->isnosizehint = -1;
|
rule->isnosizehint = -1;
|
||||||
rule->isterm = -1;
|
rule->isterm = -1;
|
||||||
|
rule->allow_csd = -1;
|
||||||
rule->noswallow = -1;
|
rule->noswallow = -1;
|
||||||
rule->nofadein = -1;
|
rule->nofadein = -1;
|
||||||
rule->nofadeout = -1;
|
rule->nofadeout = -1;
|
||||||
|
|
@ -1572,6 +1574,8 @@ void parse_option(Config *config, char *key, char *value) {
|
||||||
rule->isnosizehint = atoi(val);
|
rule->isnosizehint = atoi(val);
|
||||||
} else if (strcmp(key, "isterm") == 0) {
|
} else if (strcmp(key, "isterm") == 0) {
|
||||||
rule->isterm = atoi(val);
|
rule->isterm = atoi(val);
|
||||||
|
} else if (strcmp(key, "allow_csd") == 0) {
|
||||||
|
rule->allow_csd = atoi(val);
|
||||||
} else if (strcmp(key, "noswallow") == 0) {
|
} else if (strcmp(key, "noswallow") == 0) {
|
||||||
rule->noswallow = atoi(val);
|
rule->noswallow = atoi(val);
|
||||||
} else if (strcmp(key, "scroller_proportion") == 0) {
|
} else if (strcmp(key, "scroller_proportion") == 0) {
|
||||||
|
|
|
||||||
22
src/mango.c
22
src/mango.c
|
|
@ -324,6 +324,7 @@ struct Client {
|
||||||
bool need_output_flush;
|
bool need_output_flush;
|
||||||
struct dwl_animation animation;
|
struct dwl_animation animation;
|
||||||
int isterm, noswallow;
|
int isterm, noswallow;
|
||||||
|
int allow_csd;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
Client *swallowing, *swallowedby;
|
Client *swallowing, *swallowedby;
|
||||||
bool is_clip_to_hide;
|
bool is_clip_to_hide;
|
||||||
|
|
@ -1137,6 +1138,7 @@ void toggle_hotarea(int x_root, int y_root) {
|
||||||
|
|
||||||
static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
|
static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
|
||||||
APPLY_INT_PROP(c, r, isterm);
|
APPLY_INT_PROP(c, r, isterm);
|
||||||
|
APPLY_INT_PROP(c, r, allow_csd);
|
||||||
APPLY_INT_PROP(c, r, noswallow);
|
APPLY_INT_PROP(c, r, noswallow);
|
||||||
APPLY_INT_PROP(c, r, nofadein);
|
APPLY_INT_PROP(c, r, nofadein);
|
||||||
APPLY_INT_PROP(c, r, nofadeout);
|
APPLY_INT_PROP(c, r, nofadeout);
|
||||||
|
|
@ -3424,6 +3426,8 @@ void init_client_properties(Client *c) {
|
||||||
c->master_mfact_per = 0.0f;
|
c->master_mfact_per = 0.0f;
|
||||||
c->master_inner_per = 0.0f;
|
c->master_inner_per = 0.0f;
|
||||||
c->stack_innder_per = 0.0f;
|
c->stack_innder_per = 0.0f;
|
||||||
|
c->isterm = 0;
|
||||||
|
c->allow_csd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void // old fix to 0.5
|
void // old fix to 0.5
|
||||||
|
|
@ -4040,9 +4044,21 @@ skip:
|
||||||
|
|
||||||
void requestdecorationmode(struct wl_listener *listener, void *data) {
|
void requestdecorationmode(struct wl_listener *listener, void *data) {
|
||||||
Client *c = wl_container_of(listener, c, set_decoration_mode);
|
Client *c = wl_container_of(listener, c, set_decoration_mode);
|
||||||
if (c->surface.xdg->initialized)
|
struct wlr_xdg_toplevel_decoration_v1 *deco = data;
|
||||||
wlr_xdg_toplevel_decoration_v1_set_mode(
|
|
||||||
c->decoration, WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
if (c->surface.xdg->initialized) {
|
||||||
|
// 获取客户端请求的模式
|
||||||
|
enum wlr_xdg_toplevel_decoration_v1_mode requested_mode =
|
||||||
|
deco->requested_mode;
|
||||||
|
|
||||||
|
// 如果客户端没有指定,使用默认模式
|
||||||
|
if (!c->allow_csd) {
|
||||||
|
requested_mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 尊重客户端的请求
|
||||||
|
wlr_xdg_toplevel_decoration_v1_set_mode(c->decoration, requested_mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void requeststartdrag(struct wl_listener *listener, void *data) {
|
void requeststartdrag(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue