* Helper types
*****************************************************************************/
typedef enum { D_LEFT, D_RIGHT, D_UP, D_DOWN } direction_t;
-typedef enum { HORIZ, VERT, NO_ORIENTATION } orientation_t;
+typedef enum { NO_ORIENTATION = 0, HORIZ, VERT } orientation_t;
enum {
BIND_NONE = 0,
ws->type = CT_WORKSPACE;
ws->name = strdup("1");
ws->fullscreen_mode = CF_OUTPUT;
+ ws->orientation = HORIZ;
}
con_focus(ws);
con->orientation = orientation;
return;
}
+
+ Con *parent = con->parent;
+ /* if we are in a container whose parent contains only one
+ * child and has the same orientation like we are trying to
+ * set, this operation is a no-op to not confuse the user */
+ if (parent->orientation == orientation &&
+ TAILQ_NEXT(con, nodes) == TAILQ_END(&(parent->nodes_head)))
+ return;
+
/* 2: replace it with a new Con */
Con *new = con_new(NULL);
- Con *parent = con->parent;
TAILQ_REPLACE(&(parent->nodes_head), con, new, nodes);
TAILQ_REPLACE(&(parent->focus_head), con, new, focused);
new->parent = parent;
workspace = con_new(output);
workspace->type = CT_WORKSPACE;
workspace->name = strdup(num);
+ workspace->orientation = HORIZ;
ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"init\"}");
}