- if (!get_map(keymap, conn, device_id) ||
- !get_indicator_map(keymap, conn, device_id) ||
- !get_compat_map(keymap, conn, device_id) ||
- !get_names(keymap, conn, device_id) ||
- !get_controls(keymap, conn, device_id)) {
- xkb_keymap_unref(keymap);
- return NULL;
- }
+ struct x11_atom_interner interner;
+ x11_atom_interner_init(&interner, ctx, conn);
+
+ /*
+ * Send all requests together so only one roundtrip is needed
+ * to get the replies.
+ */
+ xcb_xkb_get_map_cookie_t map_cookie =
+ xcb_xkb_get_map(conn, device_id, get_map_required_components,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ xcb_xkb_get_indicator_map_cookie_t indicator_map_cookie =
+ xcb_xkb_get_indicator_map(conn, device_id, ALL_INDICATORS_MASK);
+ xcb_xkb_get_compat_map_cookie_t compat_map_cookie =
+ xcb_xkb_get_compat_map(conn, device_id, 0, true, 0, 0);
+ xcb_xkb_get_names_cookie_t names_cookie =
+ xcb_xkb_get_names(conn, device_id, get_names_wanted);
+ xcb_xkb_get_controls_cookie_t controls_cookie =
+ xcb_xkb_get_controls(conn, device_id);
+
+ if (!get_map(keymap, conn, map_cookie))
+ goto err_map;
+ if (!get_indicator_map(keymap, conn, indicator_map_cookie))
+ goto err_indicator_map;
+ if (!get_compat_map(keymap, conn, compat_map_cookie))
+ goto err_compat_map;
+ if (!get_names(keymap, &interner, names_cookie))
+ goto err_names;
+ if (!get_controls(keymap, conn, controls_cookie))
+ goto err_controls;
+ x11_atom_interner_round_trip(&interner);
+ if (interner.had_error)
+ goto err_interner;