删除 client 不必要的属性

This commit is contained in:
2026-01-29 09:59:14 +08:00
parent 6f4690705a
commit a748159dcd
4 changed files with 1 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ _XKB_RULES_NAMES
WM_PROTOCOLS WM_PROTOCOLS
WM_TAKE_FOCUS WM_TAKE_FOCUS
WM_NAME WM_NAME
WM_ICON_NAME
WM_WINDOW_ROLE WM_WINDOW_ROLE
UTF8_STRING UTF8_STRING
@@ -13,7 +12,6 @@ _NET_ACTIVE_WINDOW
_NET_CLIENT_LIST _NET_CLIENT_LIST
_NET_WM_DESKTOP _NET_WM_DESKTOP
_NET_WM_NAME _NET_WM_NAME
_NET_WM_ICON_NAME
_NET_WM_STATE _NET_WM_STATE
_NET_WM_STATE_FULLSCREEN _NET_WM_STATE_FULLSCREEN
_NET_WM_WINDOW_TYPE _NET_WM_WINDOW_TYPE

View File

@@ -117,9 +117,7 @@ static inline void client_wipe(client_t *client) {
p_delete(&client->class); p_delete(&client->class);
p_delete(&client->instance); p_delete(&client->instance);
p_delete(&client->name); p_delete(&client->name);
p_delete(&client->icon_name);
p_delete(&client->net_name); p_delete(&client->net_name);
p_delete(&client->net_icon_name);
p_delete(&client->role); p_delete(&client->role);
p_delete(&client); p_delete(&client);
} }
@@ -138,9 +136,7 @@ static inline void client_tags_apply(client_t *client) {
static inline void client_update_names(client_t *c) { static inline void client_update_names(client_t *c) {
xwindow_get_text_property(c->window, WM_NAME, &c->name); xwindow_get_text_property(c->window, WM_NAME, &c->name);
xwindow_get_text_property(c->window, WM_ICON_NAME, &c->icon_name);
xwindow_get_text_property(c->window, _NET_WM_NAME, &c->net_name); xwindow_get_text_property(c->window, _NET_WM_NAME, &c->net_name);
xwindow_get_text_property(c->window, _NET_WM_ICON_NAME, &c->net_icon_name);
} }
static inline void client_init_geometry(client_t *c) { static inline void client_init_geometry(client_t *c) {
@@ -250,9 +246,7 @@ void client_manage(xcb_window_t window,
} }
char **client_get_task_title(client_t *client) { char **client_get_task_title(client_t *client) {
if (client->net_icon_name) return &client->net_icon_name;
if (client->net_name) return &client->net_name; if (client->net_name) return &client->net_name;
if (client->icon_name) return &client->icon_name;
if (client->name) return &client->name; if (client->name) return &client->name;
return nullptr; return nullptr;
} }

View File

@@ -175,16 +175,9 @@ static void property_notify(xcb_property_notify_event_t *ev) {
if (ev->atom == WM_NAME) { if (ev->atom == WM_NAME) {
xwindow_get_text_property(ev->window, ev->atom, &client->name); xwindow_get_text_property(ev->window, ev->atom, &client->name);
monitor_draw_bar(client->monitor); monitor_draw_bar(client->monitor);
} else if (ev->atom == WM_ICON_NAME) {
if (client->icon_name) p_delete(&client->icon_name);
xwindow_get_text_property(ev->window, ev->atom, &client->icon_name);
monitor_draw_bar(client->monitor);
} else if (ev->atom == _NET_WM_NAME) { } else if (ev->atom == _NET_WM_NAME) {
xwindow_get_text_property(ev->window, ev->atom, &client->net_name); xwindow_get_text_property(ev->window, ev->atom, &client->net_name);
monitor_draw_bar(client->monitor); monitor_draw_bar(client->monitor);
} else if (ev->atom == _NET_WM_ICON_NAME) {
xwindow_get_text_property(ev->window, ev->atom, &client->net_icon_name);
monitor_draw_bar(client->monitor);
} else if (ev->atom == XCB_ATOM_WM_HINTS) { } else if (ev->atom == XCB_ATOM_WM_HINTS) {
client_update_wm_hints(client); client_update_wm_hints(client);
monitor_draw_bar(client->monitor); monitor_draw_bar(client->monitor);

View File

@@ -41,7 +41,7 @@ struct client_t {
bool size_freeze; /* 尺寸冻结窗口一定是浮动窗口 */ bool size_freeze; /* 尺寸冻结窗口一定是浮动窗口 */
char *class, *instance; char *class, *instance;
char *name, *icon_name, *net_name, *net_icon_name; char *name, *net_name;
char *role; char *role;
xcb_window_t transient_for_window; xcb_window_t transient_for_window;