Merge pull request #2040 from Airblader/bug-2034
Fix crash when trying to split and float a dock container.
This commit is contained in:
commit
2451551f63
|
@ -112,6 +112,12 @@ bool con_is_internal(Con *con);
|
||||||
*/
|
*/
|
||||||
bool con_is_floating(Con *con);
|
bool con_is_floating(Con *con);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the container is a docked container.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool con_is_docked(Con *con);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given container is either floating or inside some floating
|
* Checks if the given container is either floating or inside some floating
|
||||||
* container. It returns the FLOATING_CON container.
|
* container. It returns the FLOATING_CON container.
|
||||||
|
|
|
@ -1192,16 +1192,18 @@ void cmd_move_workspace_to_output(I3_CMD, const char *name) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cmd_split(I3_CMD, const char *direction) {
|
void cmd_split(I3_CMD, const char *direction) {
|
||||||
|
HANDLE_EMPTY_MATCH;
|
||||||
|
|
||||||
owindow *current;
|
owindow *current;
|
||||||
/* TODO: use matches */
|
|
||||||
LOG("splitting in direction %c\n", direction[0]);
|
LOG("splitting in direction %c\n", direction[0]);
|
||||||
if (match_is_empty(current_match))
|
TAILQ_FOREACH(current, &owindows, owindows) {
|
||||||
tree_split(focused, (direction[0] == 'v' ? VERT : HORIZ));
|
if (con_is_docked(current->con)) {
|
||||||
else {
|
ELOG("Cannot split a docked container, skipping.\n");
|
||||||
TAILQ_FOREACH(current, &owindows, owindows) {
|
continue;
|
||||||
DLOG("matching: %p / %s\n", current->con, current->con->name);
|
|
||||||
tree_split(current->con, (direction[0] == 'v' ? VERT : HORIZ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DLOG("matching: %p / %s\n", current->con, current->con->name);
|
||||||
|
tree_split(current->con, (direction[0] == 'v' ? VERT : HORIZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_output->needs_tree_render = true;
|
cmd_output->needs_tree_render = true;
|
||||||
|
@ -1528,9 +1530,10 @@ void cmd_move_direction(I3_CMD, const char *direction, long move_px) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void cmd_layout(I3_CMD, const char *layout_str) {
|
void cmd_layout(I3_CMD, const char *layout_str) {
|
||||||
|
HANDLE_EMPTY_MATCH;
|
||||||
|
|
||||||
if (strcmp(layout_str, "stacking") == 0)
|
if (strcmp(layout_str, "stacking") == 0)
|
||||||
layout_str = "stacked";
|
layout_str = "stacked";
|
||||||
owindow *current;
|
|
||||||
layout_t layout;
|
layout_t layout;
|
||||||
/* default is a special case which will be handled in con_set_layout(). */
|
/* default is a special case which will be handled in con_set_layout(). */
|
||||||
if (strcmp(layout_str, "default") == 0)
|
if (strcmp(layout_str, "default") == 0)
|
||||||
|
@ -1550,14 +1553,15 @@ void cmd_layout(I3_CMD, const char *layout_str) {
|
||||||
|
|
||||||
DLOG("changing layout to %s (%d)\n", layout_str, layout);
|
DLOG("changing layout to %s (%d)\n", layout_str, layout);
|
||||||
|
|
||||||
/* check if the match is empty, not if the result is empty */
|
owindow *current;
|
||||||
if (match_is_empty(current_match))
|
TAILQ_FOREACH(current, &owindows, owindows) {
|
||||||
con_set_layout(focused, layout);
|
if (con_is_docked(current->con)) {
|
||||||
else {
|
ELOG("cannot change layout of a docked container, skipping it.\n");
|
||||||
TAILQ_FOREACH(current, &owindows, owindows) {
|
continue;
|
||||||
DLOG("matching: %p / %s\n", current->con, current->con->name);
|
|
||||||
con_set_layout(current->con, layout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DLOG("matching: %p / %s\n", current->con, current->con->name);
|
||||||
|
con_set_layout(current->con, layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_output->needs_tree_render = true;
|
cmd_output->needs_tree_render = true;
|
||||||
|
|
14
src/con.c
14
src/con.c
|
@ -448,6 +448,20 @@ bool con_is_floating(Con *con) {
|
||||||
return (con->floating >= FLOATING_AUTO_ON);
|
return (con->floating >= FLOATING_AUTO_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns true if the container is a docked container.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool con_is_docked(Con *con) {
|
||||||
|
if (con->parent == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (con->parent->type == CT_DOCKAREA)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return con_is_docked(con->parent);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks if the given container is either floating or inside some floating
|
* Checks if the given container is either floating or inside some floating
|
||||||
* container. It returns the FLOATING_CON container.
|
* container. It returns the FLOATING_CON container.
|
||||||
|
|
|
@ -108,7 +108,7 @@ void floating_check_size(Con *floating_con) {
|
||||||
void floating_enable(Con *con, bool automatic) {
|
void floating_enable(Con *con, bool automatic) {
|
||||||
bool set_focus = (con == focused);
|
bool set_focus = (con == focused);
|
||||||
|
|
||||||
if (con->parent && con->parent->type == CT_DOCKAREA) {
|
if (con_is_docked(con)) {
|
||||||
LOG("Container is a dock window, not enabling floating mode.\n");
|
LOG("Container is a dock window, not enabling floating mode.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue