c - How to register events using libxcb-xinput -
i'm trying listen touch events (touch_begin, touch_update, touch_end , touch_ownership) on root window.
touch events aren't directly integrated xcb, have use input extension (libxcb-xinput).
i managed set event listener events coming input extension, can't figure out how register events want listen to.
i tried using xcb_input_xi_select_events(), function takes parameter of type xcb_input_event_mask_t, while enum containing event masks of type xcb_input_xi_event_mask_t , there no obvious way cast them.
for reason think xcb_input_xi_select_events() wrong function, have no idea function use instead.
my non working code looks that:
xcb_input_event_mask_t mask[] = { xcb_input_xi_event_mask_touch_begin | xcb_input_xi_event_mask_touch_end | xcb_input_xi_event_mask_touch_update | xcb_input_xi_event_mask_touch_ownership }; xcb_input_xi_select_events(dpy, root, 4, mask);
the core throws "large integer implicitly truncated unsigned type" warning @ compile time , "failed request: (null), (null): 0x000000d5" error @ runtime.
(i'm pretty new c , xcb, please forgive obvious errors)
i found solution this.
big https://github.com/eemikula/touchwm.
const uint32_t mask[] = { xcb_input_xi_event_mask_touch_begin | xcb_input_xi_event_mask_touch_update | xcb_input_xi_event_mask_touch_end | xcb_input_xi_event_mask_touch_ownership }; const uint32_t modifiers[] = {xcb_input_modifier_mask_any}; xcb_input_xi_passive_grab_device( dpy, xcb_current_time, root, xcb_cursor_none, 0, // detail - used xipassivegrab xcb_input_device_all_master, 1, // num_modifiers 1, // mask_len xcb_input_grab_type_touch_begin, xcb_input_grab_mode_22_touch, xcb_input_grab_mode_22_async, xcb_input_grab_owner_no_owner, mask, modifiers );
it looks bit cryptic, works.
Comments
Post a Comment