使用XCB,我需要将窗口的鼠标指针更改为标准手形光标(无论在Linux中是什么意思,我需要一个独立于工具包的解决方案)。
注意:加载“cursor”字体并将窗口属性XCB_CW_CURSOR更改为XC_hand2不是解决方案。这会加载X11丑陋且不熟悉的手形光标,而不是您在悬停链接时在Chrome中看到的默认Ubuntu手形光标。
感谢。
答案 0 :(得分:2)
显然,你必须:
加载"手的代码"光标(ref):
xcb_cursor_context_t *ctx;
if (xcb_cursor_context_new(connection, defaultScreen, &ctx) >= 0) {
xcb_cursor_t cursor = xcb_cursor_load_cursor(ctx, "pointing_hand");
if (cursor == XCB_CURSOR_NONE) // they come with various names ...
cursor = xcb_cursor_load_cursor(ctx, "hand2");
if (cursor == XCB_CURSOR_NONE)
cursor = xcb_cursor_load_cursor(ctx, "hand");
if (cursor == XCB_CURSOR_NONE)
cursor = xcb_cursor_load_cursor(ctx, "hand1");
if (cursor == XCB_CURSOR_NONE)
cursor = xcb_cursor_load_cursor(ctx, "pointer");
if (cursor == XCB_CURSOR_NONE)
cursor = xcb_cursor_load_cursor(ctx, "e29285e634086352946a0e7090d73106");
if (cursor == XCB_CURSOR_NONE)
cursor = xcb_cursor_load_cursor(ctx, "9d800788f1b08800ae810202380a0822");
if (cursor != XCB_CURSOR_NONE) {
xcb_change_window_attributes(connection, window, XCB_CW_CURSOR, &cursor);
}
xcb_cursor_context_free(ctx);
}