feat: add allow_csd option to windowrule
This commit is contained in:
@@ -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;
|
||||||
int noblur;
|
int noblur;
|
||||||
float focused_opacity;
|
float focused_opacity;
|
||||||
@@ -1544,6 +1545,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->noblur = -1;
|
rule->noblur = -1;
|
||||||
rule->nofadein = -1;
|
rule->nofadein = -1;
|
||||||
@@ -1636,6 +1638,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, "noblur") == 0) {
|
} else if (strcmp(key, "noblur") == 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;
|
||||||
@@ -1127,6 +1128,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);
|
||||||
@@ -3507,6 +3509,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
|
||||||
@@ -4102,9 +4106,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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user