Hi, Am 08.12.2015 um 13:46 schrieb Laércio de Sousa: [...] > diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c > index 49516bb..249b210 100644 > --- a/hw/kdrive/ephyr/hostx.c > +++ b/hw/kdrive/ephyr/hostx.c [...] > @@ -1086,18 +1085,105 @@ hostx_paint_debug_rect(KdScreenInfo *screen, > nanosleep(&tspec, NULL); > } > > -void > -hostx_load_keymap(void) > +Bool > +hostx_load_keymap(KeySymsPtr keySyms, CARD8 *modmap, XkbControlsPtr controls) > { > int min_keycode, max_keycode; > + int map_width; > + size_t i, j; > + int keymap_len; > + xcb_keysym_t *keymap; > + xcb_keycode_t *modifier_map; > + xcb_get_keyboard_mapping_cookie_t mapping_c; > + xcb_get_keyboard_mapping_reply_t *mapping_r; > + xcb_get_modifier_mapping_cookie_t modifier_c; > + xcb_get_modifier_mapping_reply_t *modifier_r; > + xcb_xkb_use_extension_cookie_t use_c; > + xcb_xkb_use_extension_reply_t *use_r; > + xcb_xkb_get_controls_cookie_t controls_c; > + xcb_xkb_get_controls_reply_t *controls_r; > > min_keycode = xcb_get_setup(HostX.conn)->min_keycode; > max_keycode = xcb_get_setup(HostX.conn)->max_keycode; > > EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode); > > - ephyrKeySyms.minKeyCode = min_keycode; > - ephyrKeySyms.maxKeyCode = max_keycode; > + keySyms->minKeyCode = min_keycode; > + keySyms->maxKeyCode = max_keycode; > + > + use_c = xcb_xkb_use_extension(HostX.conn, > + XCB_XKB_MAJOR_VERSION, > + XCB_XKB_MINOR_VERSION); > + use_r = xcb_xkb_use_extension_reply(HostX.conn, use_c, NULL);
Could you check xcb_get_extension_data(HostX.conn, &xcb_xkb_id)->present first? I don't know why XKB's UseExtension has a supported field, but without this suggested check, the XCB connection will just go in an error state if the XKB connection is not actually present. > + > + if (!use_r) { > + EPHYR_LOG_ERROR("Couldn't use XKB extension."); > + return FALSE; > + } else if (!use_r->supported) { > + EPHYR_LOG_ERROR("XKB extension is not supported in X server."); > + free(use_r); > + return FALSE; > + } > + > + free(use_r); > + > + controls_c = xcb_xkb_get_controls(HostX.conn, > + XCB_XKB_ID_USE_CORE_KBD); > + controls_r = xcb_xkb_get_controls_reply(HostX.conn, > + controls_c, > + NULL); > + > + if (!controls_r) { > + EPHYR_LOG_ERROR("Couldn't get XKB keyboard controls."); > + return FALSE; For this one you check for errors, with the following ones you do not. Is there a reason for that? > + } > + > + mapping_c = xcb_get_keyboard_mapping(HostX.conn, > + min_keycode, > + max_keycode - min_keycode + 1); > + mapping_r = xcb_get_keyboard_mapping_reply(HostX.conn, > + mapping_c, > + NULL); > + map_width = mapping_r->keysyms_per_keycode; > + keymap = xcb_get_keyboard_mapping_keysyms(mapping_r); > + keymap_len = xcb_get_keyboard_mapping_keysyms_length(mapping_r); > + > + modifier_c = xcb_get_modifier_mapping(HostX.conn); > + modifier_r = xcb_get_modifier_mapping_reply(HostX.conn, > + modifier_c, > + NULL); Also, even though it will never matter much, could you first send all the requests and then get the replies? [...] No clue about the rest. I don't really understand this. :-) Cheers, Uli -- “Some people are worth melting for.” - Olaf _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel