- /* There is no parent container with the same orientation */
- if (!same_orientation) {
- if (con_is_floating(con)) {
- /* this is a floating con, we just disable floating */
- floating_disable(con, true);
- return;
- }
- if (con_inside_floating(con)) {
- /* 'con' should be moved out of a floating container */
- DLOG("Inside floating, moving to workspace\n");
- attach_to_workspace(con, con_get_workspace(con));
- goto end;
- }
- DLOG("Force-changing orientation\n");
- ws_force_orientation(con_get_workspace(con), o);
- same_orientation = con_parent_with_orientation(con, o);
- }
-
- /* easy case: the move is within this container */
- if (same_orientation == con->parent) {
- DLOG("We are in the same container\n");
- Con *swap;
- /* TODO: TAILQ_SWAP? */
- if (direction == TOK_LEFT || direction == TOK_UP) {
- if (!(swap = TAILQ_PREV(con, nodes_head, nodes)))
+ /* The do {} while is used to 'restart' at this point with a different
+ * same_orientation, see the very last lines before the end of this block
+ * */
+ do {
+ /* There is no parent container with the same orientation */
+ if (!same_orientation) {
+ if (con_is_floating(con)) {
+ /* this is a floating con, we just disable floating */
+ floating_disable(con, true);