feat(listeners): 调整通知结构体字段并补充文档注释
This commit is contained in:
@@ -30,13 +30,14 @@ typedef void zdwm_workspace_active_updated(
|
|||||||
typedef struct zdwm_layout_notify_t {
|
typedef struct zdwm_layout_notify_t {
|
||||||
zdwm_workspace_id_t workspace;
|
zdwm_workspace_id_t workspace;
|
||||||
zdwm_layout_id_t id;
|
zdwm_layout_id_t id;
|
||||||
const char *symbol; /* 不持有内存 */
|
const char *name; /* 不持有内存 */
|
||||||
|
const char *symbol; /* 不持有内存 */
|
||||||
|
const char *description; /* 不持有内存 */
|
||||||
} zdwm_layout_notify_t;
|
} zdwm_layout_notify_t;
|
||||||
typedef void zdwm_layout_notify(zdwm_layout_notify_t layout, void *user_data);
|
typedef void zdwm_layout_notify(zdwm_layout_notify_t layout, void *user_data);
|
||||||
|
|
||||||
typedef struct zdwm_binding_mode_notify_t {
|
typedef struct zdwm_binding_mode_notify_t {
|
||||||
bool is_default_mode;
|
bool is_default_mode;
|
||||||
bool is_current_mode;
|
|
||||||
zdwm_binding_mode_id_t id;
|
zdwm_binding_mode_id_t id;
|
||||||
const char *name; /* 不持有内存 */
|
const char *name; /* 不持有内存 */
|
||||||
} zdwm_binding_mode_notify_t;
|
} zdwm_binding_mode_notify_t;
|
||||||
|
|||||||
@@ -173,9 +173,11 @@ void listeners_notify_layout(
|
|||||||
if (!slot) return;
|
if (!slot) return;
|
||||||
|
|
||||||
zdwm_layout_notify_t notify = {
|
zdwm_layout_notify_t notify = {
|
||||||
.workspace = workspace_id,
|
.workspace = workspace_id,
|
||||||
.id = layout_id,
|
.id = layout_id,
|
||||||
.symbol = slot->symbol,
|
.name = slot->name,
|
||||||
|
.symbol = slot->symbol,
|
||||||
|
.description = slot->description,
|
||||||
};
|
};
|
||||||
|
|
||||||
FOR_EACH_LISTENER(layout_listeners, item->fn(notify, item->user_data));
|
FOR_EACH_LISTENER(layout_listeners, item->fn(notify, item->user_data));
|
||||||
|
|||||||
@@ -95,43 +95,87 @@ void listeners_add_window_removed_listener(
|
|||||||
);
|
);
|
||||||
|
|
||||||
void listeners_cleanup(listeners_t *listeners);
|
void listeners_cleanup(listeners_t *listeners);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知当前 output 信息
|
||||||
|
*
|
||||||
|
* @param listeners 通知函数集合
|
||||||
|
* @param output_id 当前 output id
|
||||||
|
*/
|
||||||
void listeners_notify_current_output(
|
void listeners_notify_current_output(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
output_id_t output_id
|
output_id_t output_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知初始化 workspace 列表
|
||||||
|
*/
|
||||||
void listeners_notify_initial_workspaces(
|
void listeners_notify_initial_workspaces(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
const state_t *state
|
const state_t *state
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知当前激活的 workspace 信息
|
||||||
|
*/
|
||||||
void listeners_notify_workspace_active(
|
void listeners_notify_workspace_active(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
output_id_t output_id,
|
output_id_t output_id,
|
||||||
workspace_id_t workspace_id
|
workspace_id_t workspace_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知当前布局信息
|
||||||
|
*
|
||||||
|
* @param listeners 通知函数集合
|
||||||
|
* @param layouts 布局注册系统
|
||||||
|
* @param workspace_id 当前 workspace id
|
||||||
|
* @param layout_id 当前 workspace 的当前布局 id
|
||||||
|
*/
|
||||||
void listeners_notify_layout(
|
void listeners_notify_layout(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
const layout_registry_t *layouts,
|
const layout_registry_t *layouts,
|
||||||
workspace_id_t workspace_id,
|
workspace_id_t workspace_id,
|
||||||
layout_id_t layout_id
|
layout_id_t layout_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知当前绑定模式信息
|
||||||
|
*/
|
||||||
void listeners_notify_binding_mode(
|
void listeners_notify_binding_mode(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
const binding_table_t *binding_table
|
const binding_table_t *binding_table
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知初始窗口列表
|
||||||
|
*/
|
||||||
void listeners_notify_initial_windows(
|
void listeners_notify_initial_windows(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
const state_t *state
|
const state_t *state
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知新增窗口
|
||||||
|
*/
|
||||||
void listeners_notify_window_added(
|
void listeners_notify_window_added(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
const state_t *state,
|
const state_t *state,
|
||||||
window_id_t window_id
|
window_id_t window_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知窗口信息更新
|
||||||
|
*/
|
||||||
void listeners_notify_window_updated(
|
void listeners_notify_window_updated(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
const state_t *state,
|
const state_t *state,
|
||||||
window_id_t window_id
|
window_id_t window_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 通知移除窗口
|
||||||
|
*/
|
||||||
void listeners_notify_window_removed(
|
void listeners_notify_window_removed(
|
||||||
const listeners_t *listeners,
|
const listeners_t *listeners,
|
||||||
window_id_t window_id
|
window_id_t window_id
|
||||||
|
|||||||
Reference in New Issue
Block a user