c - Change mouse cursor to standard hand cursor in XCB -


using xcb, need change mouse pointer window standard hand cursor (whatever means in linux, need toolkit-independent solution).

note: loading "cursor" font , changing window attribute xcb_cw_cursor xc_hand2 not solution. loads x11 ugly , unfamiliar hand cursor, not default ubuntu hand cursor see in chrome when hover links.

thanks.

apparently, have to:

  1. download , build xcb/util-cursor because it's not included in older linuxes
  2. use load cursor (they're called "themed cursors")
  3. try out bunch of cursor names because not standardized.

code loading "hand" cursor (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) // come 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); } 

Comments