refactor(backend/X11): 重构 effect 应用为延迟批量模式并添加 KILL_WINDOW 支持

- 添加 ZDWM_EFFECT_KILL_WINDOW 副作用和 WM_DELETE_WINDOW 协议支持
- 将 backend_apply_effect 从即时调用 X11 拆分为 merge + batch apply 两阶段:
  - 先收集 effect 到后端持有的列表
  - 再按 unmap(grab server) → map → kill → configure → focus 顺序统一提交
This commit is contained in:
2026-04-23 04:37:34 +08:00
parent 28ebb086b1
commit fc68e75f82
5 changed files with 213 additions and 55 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
@@ -13,6 +15,7 @@
\
X(WM_PROTOCOLS) \
X(WM_TAKE_FOCUS) \
X(WM_DELETE_WINDOW) \
X(_NET_ACTIVE_WINDOW) \
\
X(_NET_SUPPORTING_WM_CHECK) \
@@ -54,6 +57,24 @@ typedef struct atoms_t {
#undef DECLARATION_ATOM
} atoms_t;
typedef struct window_configure_t {
xcb_window_t window;
uint16_t mask;
xcb_configure_window_value_list_t value;
} window_configure_t;
typedef struct window_configure_list_t {
window_configure_t *cfgs;
size_t count;
size_t capacity;
} window_configure_list_t;
typedef struct window_list_t {
xcb_window_t *windows;
size_t count;
size_t capacity;
} window_list_t;
struct backend_t {
xcb_connection_t *conn;
xcb_screen_t *screen;
@@ -65,4 +86,12 @@ struct backend_t {
/* When no window should take focus, then focus this window */
xcb_window_t window_no_focus;
xcb_window_t wm_check_window;
xcb_window_t focus_window;
bool update_focus;
window_configure_list_t config_list;
window_list_t unmap;
window_list_t map;
window_list_t kill;
};