style: 更新 .clang-format 规则并重新格式化所有源文件

- 重构模块使用新的代码风格
- 老代码 (src 目录下的代码) 继续使用之前的代码风格

通过在需要不同代码风格的目录下放对应 .clang-format 配置文件实现
This commit is contained in:
2026-04-14 01:52:53 +08:00
parent 7b5404e8e0
commit 2fc4b33359
62 changed files with 1248 additions and 728 deletions

View File

@@ -10,12 +10,12 @@
bool rules_move(rules_t *src, rules_t *dest) {
if (!dest || !src) return false;
dest->items = src->items;
dest->count = src->count;
dest->items = src->items;
dest->count = src->count;
dest->capacity = src->capacity;
src->items = nullptr;
src->count = 0;
src->items = nullptr;
src->count = 0;
src->capacity = 0;
return true;
@@ -23,7 +23,7 @@ bool rules_move(rules_t *src, rules_t *dest) {
void rules_cleanup(rules_t *rules) {
for (size_t i = 0; i < rules->count; ++i) {
rule_match_t *match = &rules->items[i].match;
rule_match_t *match = &rules->items[i].match;
rule_action_t *action = &rules->items[i].action;
p_delete(&match->app_id);
@@ -37,15 +37,15 @@ void rules_cleanup(rules_t *rules) {
p_delete(&rules->items);
rules->capacity = 0;
rules->count = 0;
rules->count = 0;
}
static inline bool str_match(const char *pattern, const char *value) {
return !pattern || (value && strcmp(pattern, value) == 0);
}
static bool rule_match_window(const rule_match_t *match,
const window_metadata_t *meta) {
static bool
rule_match_window(const rule_match_t *match, const window_metadata_t *meta) {
return str_match(match->app_id, meta->app_id) &&
str_match(match->role, meta->role) &&
str_match(match->class_name, meta->class_name) &&
@@ -59,13 +59,16 @@ static void rule_action_merge(const rule_action_t *src, rule_action_t *dest) {
dest->workspace = src->workspace;
}
dest->switch_to_workspace |= src->switch_to_workspace;
dest->fullscreen |= src->fullscreen;
dest->maximize |= src->maximize;
dest->floating |= src->floating;
dest->fullscreen |= src->fullscreen;
dest->maximize |= src->maximize;
dest->floating |= src->floating;
}
bool rules_resolve(const rules_t *rules, const window_metadata_t *metadata,
rule_action_t *action_out) {
bool rules_resolve(
const rules_t *rules,
const window_metadata_t *metadata,
rule_action_t *action_out
) {
if (!action_out) return false;
bool matched = false;