我正在尝试获取关注窗口的信息。从 xcb_get_input_focus_reply_t->focus
中,我似乎得到了正确的窗口ID:对于我的 Eclipse IDE(56623164),它保持不变,而对于其他任何关注窗口,它都是另一个值。然而,对于 XCB_ATOM_WM_NAME
,值的长度始终为0。
缩短的代码
cookie = xcb_get_property(c, 0, fr->focus, XCB_ATOM_WM_NAME,
XCB_ATOM_STRING, 0, 0);
if ((reply = xcb_get_property_reply(c, cookie, NULL))) {
int len = xcb_get_property_value_length(reply);
if (len == 0) {
printf("Zero Length\n");
free(reply);
return;
}
printf("WM_NAME is %.*s\n", len, (char*) xcb_get_property_value(reply));
}
Eclipse调试器
reply xcb_get_property_reply_t * 0x60bd40
response_type uint8_t 1 '\001'
format uint8_t 0 '\0'
sequence uint16_t 2
length uint32_t 0
type xcb_atom_t 0
bytes_after uint32_t 0
value_len uint32_t 0
pad0 unsigned char [12] 0x60bd54
没有错误(我已经通过并检查了 xcb_generic_error_t
)。你有任何想法出了什么问题吗?也许我应该使用 Xlib 代替...