ignore MotionNotify events generated while warping the pointer
This commit is contained in:
parent
9edbcc4790
commit
d8e27dd5aa
|
@ -45,6 +45,15 @@
|
||||||
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | /* …subwindows get notifies */ \
|
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | /* …subwindows get notifies */ \
|
||||||
XCB_EVENT_MASK_ENTER_WINDOW) /* …user moves cursor inside our window */
|
XCB_EVENT_MASK_ENTER_WINDOW) /* …user moves cursor inside our window */
|
||||||
|
|
||||||
|
#define ROOT_EVENT_MASK (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | \
|
||||||
|
XCB_EVENT_MASK_BUTTON_PRESS | \
|
||||||
|
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* when the user adds a screen (e.g. video \
|
||||||
|
projector), the root window gets a \
|
||||||
|
ConfigureNotify */ \
|
||||||
|
XCB_EVENT_MASK_POINTER_MOTION | \
|
||||||
|
XCB_EVENT_MASK_PROPERTY_CHANGE | \
|
||||||
|
XCB_EVENT_MASK_ENTER_WINDOW)
|
||||||
|
|
||||||
#define xmacro(atom) xcb_atom_t A_ ## atom;
|
#define xmacro(atom) xcb_atom_t A_ ## atom;
|
||||||
#include "atoms.xmacro"
|
#include "atoms.xmacro"
|
||||||
#undef xmacro
|
#undef xmacro
|
||||||
|
|
11
src/main.c
11
src/main.c
|
@ -541,17 +541,8 @@ int main(int argc, char *argv[]) {
|
||||||
config.ipc_socket_path = sstrdup(config.ipc_socket_path);
|
config.ipc_socket_path = sstrdup(config.ipc_socket_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t mask = XCB_CW_EVENT_MASK;
|
|
||||||
uint32_t values[] = { XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
|
|
||||||
XCB_EVENT_MASK_BUTTON_PRESS |
|
|
||||||
XCB_EVENT_MASK_STRUCTURE_NOTIFY | /* when the user adds a screen (e.g. video
|
|
||||||
projector), the root window gets a
|
|
||||||
ConfigureNotify */
|
|
||||||
XCB_EVENT_MASK_POINTER_MOTION |
|
|
||||||
XCB_EVENT_MASK_PROPERTY_CHANGE |
|
|
||||||
XCB_EVENT_MASK_ENTER_WINDOW };
|
|
||||||
xcb_void_cookie_t cookie;
|
xcb_void_cookie_t cookie;
|
||||||
cookie = xcb_change_window_attributes_checked(conn, root, mask, values);
|
cookie = xcb_change_window_attributes_checked(conn, root, XCB_CW_EVENT_MASK, (uint32_t[]){ ROOT_EVENT_MASK });
|
||||||
check_error(conn, cookie, "Another window manager seems to be running");
|
check_error(conn, cookie, "Another window manager seems to be running");
|
||||||
|
|
||||||
xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(conn, gcookie, NULL);
|
xcb_get_geometry_reply_t *greply = xcb_get_geometry_reply(conn, gcookie, NULL);
|
||||||
|
|
6
src/x.c
6
src/x.c
|
@ -920,8 +920,12 @@ void x_push_changes(Con *con) {
|
||||||
|
|
||||||
Output *current = get_output_containing(pointerreply->root_x, pointerreply->root_y);
|
Output *current = get_output_containing(pointerreply->root_x, pointerreply->root_y);
|
||||||
Output *target = get_output_containing(mid_x, mid_y);
|
Output *target = get_output_containing(mid_x, mid_y);
|
||||||
if (current != target)
|
if (current != target) {
|
||||||
|
/* Ignore MotionNotify events generated by warping */
|
||||||
|
xcb_change_window_attributes(conn, root, XCB_CW_EVENT_MASK, (uint32_t[]){ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT });
|
||||||
xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, mid_x, mid_y);
|
xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, mid_x, mid_y);
|
||||||
|
xcb_change_window_attributes(conn, root, XCB_CW_EVENT_MASK, (uint32_t[]){ ROOT_EVENT_MASK });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
warp_to = NULL;
|
warp_to = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue