From a06552b670c9c13f70ead34051bdff2e974685bc Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sun, 28 Sep 2025 21:12:16 +0800 Subject: [PATCH] opt: optimize code struct --- src/config/parse_config.h | 4 ++-- src/dispatch/bind_define.h | 4 ++-- src/mango.c | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 766418d..657d484 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -391,9 +391,9 @@ int parse_circle_direction(const char *str) { // 根据转换后的小写字符串返回对应的枚举值 if (strcmp(lowerStr, "next") == 0) { - return 1; + return NEXT; } else { - return -1; + return PREV; } } diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 4729fb9..b2b6551 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -78,7 +78,7 @@ void exchange_stack_client(const Arg *arg) { Client *tc; if (!c || c->isfloating || c->isfullscreen || c->ismaxmizescreen) return; - if (arg->i > 0) { + if (arg->i == NEXT) { tc = get_next_stack_client(c, false); } else { tc = get_next_stack_client(c, true); @@ -194,7 +194,7 @@ focusstack(const Arg *arg) { if (!sel || sel->isfullscreen) return; - if (arg->i > 0) { + if (arg->i == NEXT) { tc = get_next_stack_client(sel, false); } else { tc = get_next_stack_client(sel, true); diff --git a/src/mango.c b/src/mango.c index 731c200..12d665b 100644 --- a/src/mango.c +++ b/src/mango.c @@ -164,6 +164,7 @@ enum { enum { UP, DOWN, LEFT, RIGHT, UNDIR }; /* smartmovewin */ enum { NONE, OPEN, MOVE, CLOSE, TAG }; enum { UNFOLD, FOLD, INVALIDFOLD }; +enum { PREV, NEXT }; typedef struct Pertag Pertag; typedef struct Monitor Monitor;