我正在尝试获取有关焦点窗口的信息。似乎我从以下位置获得了正确的窗口 ID xcb_get_input_focus_reply_t->focus
:它对于我的 Eclipse IDE (56623164) 保持不变,对于任何其他焦点窗口来说都是另一个。但是,对于 ,值长度始终为 0 XCB_ATOM_WM_NAME
。
缩短的代码
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
没有错误(我通过并检查了 a xcb_generic_error_t
)。你知道会出什么问题吗?也许我应该改用 Xlib...