X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fx.c;h=30e6a1c48fa3d74c18093ecd8904a34f8a810d6a;hb=36224f86d1b61d73c60c757ddcc724dc70f56c28;hp=6235cfbcb7f3fedb9348379560e1dcbacc1a07a0;hpb=637d2a3d622dead4aa7b71746bcfbc0caed24bc9;p=i3%2Fi3 diff --git a/src/x.c b/src/x.c index 6235cfbc..30e6a1c4 100644 --- a/src/x.c +++ b/src/x.c @@ -12,6 +12,9 @@ xcb_window_t focused_id = XCB_NONE; static xcb_window_t *btt_stack; static int btt_stack_num; +/* Stores coordinates to warp mouse pointer to if set */ +static Rect *warp_to; + /* * Describes the X11 state we may modify (map state, position, window stack). * There is one entry per container. The state represents the current situation @@ -862,6 +865,11 @@ void x_push_changes(Con *con) { focused_id = root; } + if (warp_to) { + xcb_warp_pointer_rect(conn, warp_to); + warp_to = NULL; + } + xcb_flush(conn); DLOG("\n\n ENDING CHANGES\n\n"); @@ -937,3 +945,13 @@ void x_set_i3_atoms() { xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A_I3_CONFIG_PATH, A_UTF8_STRING, 8, strlen(current_configpath), current_configpath); } + +/* + * Set warp_to coordinates. This will trigger on the next call to + * x_push_changes(). + * + */ +void x_set_warp_to(Rect *rect) +{ + warp_to = rect; +}