mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-01 22:58:44 -04:00
feat: layer open and close type set support
This commit is contained in:
parent
43dba2151e
commit
02d70831b5
4 changed files with 64 additions and 18 deletions
|
|
@ -42,6 +42,8 @@ typedef struct {
|
|||
float scroller_proportion;
|
||||
const char *animation_type_open;
|
||||
const char *animation_type_close;
|
||||
const char *layer_animation_type_open;
|
||||
const char *layer_animation_type_close;
|
||||
int isnoborder;
|
||||
int isopensilent;
|
||||
int isnamedscratchpad;
|
||||
|
|
@ -125,6 +127,8 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
char *layer_name; // 布局名称
|
||||
char *animation_type_open;
|
||||
char *animation_type_close;
|
||||
int noblur;
|
||||
int noanim;
|
||||
int noshadow;
|
||||
|
|
@ -135,6 +139,8 @@ typedef struct {
|
|||
int layer_animations;
|
||||
char animation_type_open[10];
|
||||
char animation_type_close[10];
|
||||
char layer_animation_type_open[10];
|
||||
char layer_animation_type_close[10];
|
||||
int animation_fade_in;
|
||||
int animation_fade_out;
|
||||
int tag_animation_direction;
|
||||
|
|
@ -859,6 +865,14 @@ void parse_config_line(Config *config, const char *line) {
|
|||
snprintf(config->animation_type_close,
|
||||
sizeof(config->animation_type_close), "%.9s",
|
||||
value); // string limit to 9 char
|
||||
} else if (strcmp(key, "layer_animation_type_open") == 0) {
|
||||
snprintf(config->layer_animation_type_open,
|
||||
sizeof(config->layer_animation_type_open), "%.9s",
|
||||
value); // string limit to 9 char
|
||||
} else if (strcmp(key, "layer_animation_type_close") == 0) {
|
||||
snprintf(config->layer_animation_type_close,
|
||||
sizeof(config->layer_animation_type_close), "%.9s",
|
||||
value); // string limit to 9 char
|
||||
} else if (strcmp(key, "animation_fade_in") == 0) {
|
||||
config->animation_fade_in = atoi(value);
|
||||
} else if (strcmp(key, "animation_fade_out") == 0) {
|
||||
|
|
@ -1336,6 +1350,8 @@ void parse_config_line(Config *config, const char *line) {
|
|||
|
||||
// 设置默认值
|
||||
rule->layer_name = NULL;
|
||||
rule->animation_type_open = NULL;
|
||||
rule->animation_type_close = NULL;
|
||||
rule->noblur = 0;
|
||||
rule->noanim = 0;
|
||||
rule->noshadow = 0;
|
||||
|
|
@ -1353,6 +1369,10 @@ void parse_config_line(Config *config, const char *line) {
|
|||
|
||||
if (strcmp(key, "layer_name") == 0) {
|
||||
rule->layer_name = strdup(val);
|
||||
} else if (strcmp(key, "animation_type_open") == 0) {
|
||||
rule->animation_type_open = strdup(val);
|
||||
} else if (strcmp(key, "animation_type_close") == 0) {
|
||||
rule->animation_type_close = strdup(val);
|
||||
} else if (strcmp(key, "noblur") == 0) {
|
||||
rule->noblur = CLAMP_INT(atoi(val), 0, 1);
|
||||
} else if (strcmp(key, "noanim") == 0) {
|
||||
|
|
@ -2056,7 +2076,12 @@ void free_config(void) {
|
|||
// 释放 layer_rules
|
||||
if (config.layer_rules) {
|
||||
for (int i = 0; i < config.layer_rules_count; i++) {
|
||||
free((void *)config.layer_rules[i].layer_name);
|
||||
if (config.layer_rules[i].layer_name)
|
||||
free((void *)config.layer_rules[i].layer_name);
|
||||
if (config.layer_rules[i].animation_type_open)
|
||||
free((void *)config.layer_rules[i].animation_type_open);
|
||||
if (config.layer_rules[i].animation_type_close)
|
||||
free((void *)config.layer_rules[i].animation_type_close);
|
||||
}
|
||||
free(config.layer_rules);
|
||||
config.layer_rules = NULL;
|
||||
|
|
@ -2122,6 +2147,10 @@ void override_config(void) {
|
|||
animation_type_open = config.animation_type_open;
|
||||
animation_type_close = config.animation_type_close;
|
||||
|
||||
// layer打开关闭动画类型
|
||||
layer_animation_type_open = config.layer_animation_type_open;
|
||||
layer_animation_type_close = config.layer_animation_type_close;
|
||||
|
||||
// 动画时间限制在合理范围(1-50000ms)
|
||||
animation_duration_move =
|
||||
CLAMP_INT(config.animation_duration_move, 1, 50000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue