Grab the pointer in order to capture motions

This commit is contained in:
Bastien Dejean 2015-06-11 10:07:01 +02:00
parent 36decdad62
commit dfc03b5e26

View file

@ -327,8 +327,7 @@ void enter_notify(xcb_generic_event_t *evt)
return; return;
} }
uint32_t values[] = {CLIENT_EVENT_MASK|FFP_MASK|XCB_EVENT_MASK_POINTER_MOTION}; xcb_grab_pointer(dpy, 1, win, XCB_EVENT_MASK_POINTER_MOTION, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, XCB_CURRENT_TIME);
xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, values);
} }
void leave_notify(xcb_generic_event_t *evt) void leave_notify(xcb_generic_event_t *evt)
@ -342,8 +341,7 @@ void leave_notify(xcb_generic_event_t *evt)
return; return;
} }
uint32_t values[] = {CLIENT_EVENT_MASK|FFP_MASK}; xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, values);
} }
void motion_notify(xcb_generic_event_t *evt) void motion_notify(xcb_generic_event_t *evt)
@ -375,8 +373,7 @@ void motion_notify(xcb_generic_event_t *evt)
if (locate_window(win, &loc)) { if (locate_window(win, &loc)) {
if (loc.node != mon->desk->focus) { if (loc.node != mon->desk->focus) {
focus_node(loc.monitor, loc.desktop, loc.node); focus_node(loc.monitor, loc.desktop, loc.node);
uint32_t values[] = {CLIENT_EVENT_MASK|FFP_MASK}; xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, values);
} }
} else { } else {
xcb_point_t pt = {e->root_x, e->root_y}; xcb_point_t pt = {e->root_x, e->root_y};