xcb_window_t confine_to, border_t border, callback_t callback,
const void *extra);
+/**
+ * Repositions the CT_FLOATING_CON to have the coordinates specified by
+ * newrect, but only if the coordinates are not out-of-bounds. Also reassigns
+ * the floating con to a different workspace if this move was across different
+ * outputs.
+ *
+ */
+void floating_reposition(Con *con, Rect newrect);
+
#endif
printf("moving in direction %d\n", direction);
if (con_is_floating(focused)) {
printf("floating move with %d pixels\n", px);
+ Rect newrect = focused->parent->rect;
if (direction == TOK_LEFT) {
- focused->parent->rect.x -= px;
+ newrect.x -= px;
} else if (direction == TOK_RIGHT) {
- focused->parent->rect.x += px;
+ newrect.x += px;
} else if (direction == TOK_UP) {
- focused->parent->rect.y -= px;
+ newrect.y -= px;
} else if (direction == TOK_DOWN) {
- focused->parent->rect.y += px;
+ newrect.y += px;
}
+ floating_reposition(focused->parent, newrect);
} else {
tree_move(direction);
+ tree_render();
}
-
- tree_render();
}
| TOK_MOVE TOK_WORKSPACE STR
{
xcb_flush(conn);
}
+/*
+ * Repositions the CT_FLOATING_CON to have the coordinates specified by
+ * newrect, but only if the coordinates are not out-of-bounds. Also reassigns
+ * the floating con to a different workspace if this move was across different
+ * outputs.
+ *
+ */
+void floating_reposition(Con *con, Rect newrect) {
+ /* Sanity check: Are the new coordinates on any output? If not, we
+ * ignore that request. */
+ Output *output = get_output_containing(
+ newrect.x + (newrect.width / 2),
+ newrect.y + (newrect.height / 2));
+
+ if (!output) {
+ ELOG("No output found at destination coordinates. Not repositioning.\n");
+ return;
+ }
+
+ con->rect = newrect;
+
+ floating_maybe_reassign_ws(con);
+ tree_render();
+}
+
#if 0
/*
* Moves the client 10px to the specified direction.
event->height, newrect.height, con->border_width);
}
- /* Sanity check: Are the new coordinates on any output? If not, we
- * ignore that request. */
- Output *output = get_output_containing(
- newrect.x + (newrect.width / 2),
- newrect.y + (newrect.height / 2));
-
- if (!output) {
- ELOG("No output found at destination coordinates. Ignoring this ConfigureRequest.\n");
- fake_absolute_configure_notify(con);
- return 0;
- }
-
DLOG("Container is a floating leaf node, will do that.\n");
- floatingcon->rect = newrect;
-
- floating_maybe_reassign_ws(floatingcon);
- tree_render();
+ floating_reposition(floatingcon, newrect);
+ return 1;
}
/* Dock windows can be reconfigured in their height */