refactor(policy): 删除 action 模块,将 action -> command 解析放在 policy 模块内部
- 删除 src/core/action.c|h,将 spawn 移至 src/base/process - policy_resolve_action 实现完整的 action 分发逻辑 - binding_table_cycle_mode 改为纯计算,返回模式 ID 而非修改状态 - 从 state 移除 state_workspace_cycle_layout / state_cycle_current_output - 新增 ZDWM_COMMAND_QUIT 命令,通过 plan 标志驱动 runtime 退出 - set_binding_mode 现在生成 BIND_KEY effect 以同步后端按键绑定 - 扩展 action 数据类型支持 window_send_to_workspace 和 window_cycle_output
This commit is contained in:
@@ -231,8 +231,11 @@ bool binding_table_set_current_mode(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool binding_table_cycle_mode(binding_table_t *table, int delta) {
|
||||
if (!table || !table->modes || table->count < 1) return false;
|
||||
zdwm_binding_mode_id_t
|
||||
binding_table_cycle_mode(const binding_table_t *table, int32_t delta) {
|
||||
if (!table || !table->modes || table->count <= 1) {
|
||||
return ZDWM_BINDING_MODE_ID_INVALID;
|
||||
}
|
||||
|
||||
bool matched = false;
|
||||
size_t index = (size_t)table->current_mode;
|
||||
@@ -248,17 +251,13 @@ bool binding_table_cycle_mode(binding_table_t *table, int delta) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!matched) return false;
|
||||
|
||||
/* 只有一个模式没必要切换 */
|
||||
if (table->count == 1) return true;
|
||||
if (!matched) return ZDWM_BINDING_MODE_ID_INVALID;
|
||||
|
||||
int64_t count = (int64_t)table->count;
|
||||
int64_t next_index = ((int64_t)index + (int64_t)delta) % count;
|
||||
if (next_index < 0) next_index += count;
|
||||
table->current_mode = table->modes[next_index].id;
|
||||
|
||||
return true;
|
||||
return table->modes[next_index].id;
|
||||
}
|
||||
|
||||
const key_binding_t *
|
||||
|
||||
Reference in New Issue
Block a user