From: Ran Benita Date: Fri, 28 Feb 2014 13:12:16 +0000 (+0200) Subject: interactive-x11: beef up select_events a bit X-Git-Tag: xkbcommon-0.4.1~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6adf17bd5a01333f63a30d3f0f485207ef8165f5;p=platform%2Fupstream%2Flibxkbcommon.git interactive-x11: beef up select_events a bit - Specify in detail which parts of the events we care about. In theory the X server should not bother us with things we didn't ask for. In practice it still does, but oh well. - Use the _aux version of select_events. This is the correct one to use, the non-aux version is useless. Signed-off-by: Ran Benita --- diff --git a/test/interactive-x11.c b/test/interactive-x11.c index 843b4d2..8679dda 100644 --- a/test/interactive-x11.c +++ b/test/interactive-x11.c @@ -61,29 +61,49 @@ static bool terminate; static int select_xkb_events_for_device(xcb_connection_t *conn, int32_t device_id) { - static const xcb_xkb_map_part_t required_map_parts = - (XCB_XKB_MAP_PART_KEY_TYPES | - XCB_XKB_MAP_PART_KEY_SYMS | - XCB_XKB_MAP_PART_MODIFIER_MAP | - XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS | - XCB_XKB_MAP_PART_KEY_ACTIONS | - XCB_XKB_MAP_PART_VIRTUAL_MODS | - XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP); - - static const xcb_xkb_event_type_t required_events = - (XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY | - XCB_XKB_EVENT_TYPE_MAP_NOTIFY | - XCB_XKB_EVENT_TYPE_STATE_NOTIFY); + enum { + required_events = + (XCB_XKB_EVENT_TYPE_NEW_KEYBOARD_NOTIFY | + XCB_XKB_EVENT_TYPE_MAP_NOTIFY | + XCB_XKB_EVENT_TYPE_STATE_NOTIFY), + + required_nkn_details = + (XCB_XKB_NKN_DETAIL_KEYCODES), + + required_map_parts = + (XCB_XKB_MAP_PART_KEY_TYPES | + XCB_XKB_MAP_PART_KEY_SYMS | + XCB_XKB_MAP_PART_MODIFIER_MAP | + XCB_XKB_MAP_PART_EXPLICIT_COMPONENTS | + XCB_XKB_MAP_PART_KEY_ACTIONS | + XCB_XKB_MAP_PART_VIRTUAL_MODS | + XCB_XKB_MAP_PART_VIRTUAL_MOD_MAP), + + required_state_details = + (XCB_XKB_STATE_PART_MODIFIER_BASE | + XCB_XKB_STATE_PART_MODIFIER_LATCH | + XCB_XKB_STATE_PART_MODIFIER_LOCK | + XCB_XKB_STATE_PART_GROUP_BASE | + XCB_XKB_STATE_PART_GROUP_LATCH | + XCB_XKB_STATE_PART_GROUP_LOCK), + }; + + static const xcb_xkb_select_events_details_t details = { + .affectNewKeyboard = required_nkn_details, + .newKeyboardDetails = required_nkn_details, + .affectState = required_state_details, + .stateDetails = required_state_details, + }; xcb_void_cookie_t cookie = - xcb_xkb_select_events_checked(conn, - device_id, - required_events, - 0, - required_events, - required_map_parts, - required_map_parts, - 0); + xcb_xkb_select_events_aux_checked(conn, + device_id, + required_events, /* affectWhich */ + 0, /* clear */ + 0, /* selectAll */ + required_map_parts, /* affectMap */ + required_map_parts, /* map */ + &details); /* details */ xcb_generic_error_t *error = xcb_request_check(conn, cookie); if (error) {