*/
void x_set_i3_atoms();
+/**
+ * Set warp_to coordinates. This will trigger on the next call to
+ * x_push_changes().
+ *
+ */
+void x_set_warp_to(Rect *rect);
+
#endif
if (source_output != dest_output &&
workspace_is_visible(workspace)) {
workspace_show(workspace->name);
+
+ /* Unset warp_to if target con is floating. Otherwise, set warp_to to
+ * current target container. */
+ if (con->type == CT_FLOATING_CON)
+ x_set_warp_to(NULL);
+ else
+ x_set_warp_to(&(con->rect));
}
DLOG("Re-attaching container to %p / %s\n", next, next->name);
workspace_show(workspace->name);
Con *focus = con_descend_direction(workspace, direction);
- if (focus)
+ if (focus) {
con_focus(focus);
+ x_set_warp_to(&(focus->rect));
+ }
return true;
}
/* Set mouse pointer */
Con *new_output = con_get_output(focused);
if (old_output != new_output) {
- xcb_warp_pointer_rect(conn, &next->rect);
+ x_set_warp_to(&next->rect);
}
/* Update the EWMH hints */
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
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");
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;
+}
*
*/
void xcb_warp_pointer_rect(xcb_connection_t *conn, Rect *rect) {
- xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0,
- rect->x + (rect->width / 2),
- rect->y + (rect->height / 2));
+ int mid_x = rect->x + (rect->width / 2);
+ int mid_y = rect->y + (rect->height / 2);
+
+ LOG("warp pointer to: %d %d\n", mid_x, mid_y);
+ xcb_warp_pointer(conn, XCB_NONE, root, 0, 0, 0, 0, mid_x, mid_y);
}