floating bug fix

This commit is contained in:
taiyu 2015-08-20 19:24:07 -07:00
parent c61105d1e2
commit 4af49202c7
4 changed files with 14 additions and 7 deletions

View file

@ -107,6 +107,9 @@ swayc_t *new_output(wlc_handle handle) {
// create and initilize default workspace
swayc_t *ws = new_workspace(output, ws_name);
ws->is_focused = true;
if (!active_workspace) {
active_workspace = ws;
}
free(ws_name);

View file

@ -86,7 +86,10 @@ void set_focused_container(swayc_t *c) {
sway_log(L_DEBUG, "Setting focus to %p:%ld", c, c->handle);
// Get workspace for c, get that workspaces current focused container.
// if that focsued container is fullscreen dont change focus
swayc_t *workspace = swayc_parent_by_type(c, C_WORKSPACE);
swayc_t *workspace = c;
if (workspace->type != C_WORKSPACE) {
workspace = swayc_parent_by_type(c, C_WORKSPACE);
}
swayc_t *focused = get_focused_view(workspace);
if (active_workspace == workspace && swayc_is_fullscreen(focused)) {
return;

View file

@ -37,7 +37,8 @@ void add_child(swayc_t *parent, swayc_t *child) {
child->parent = parent;
// set focus for this container
if (parent->children->length == 1) {
set_focused_container_for(parent, child);
parent->focused = child;
set_focused_container_for(parent, get_focused_view(parent));
}
}
@ -48,7 +49,7 @@ void add_floating(swayc_t *ws, swayc_t *child) {
child->parent = ws;
child->is_floating = true;
if (!ws->focused) {
set_focused_container_for(ws, child);
ws->focused = child;
}
}
@ -73,7 +74,7 @@ swayc_t *replace_child(swayc_t *child, swayc_t *new_child) {
new_child->parent = child->parent;
if (child->parent->focused == child) {
set_focused_container_for(child->parent, new_child);
child->parent->focused = new_child;
}
child->parent = NULL;
return parent;
@ -102,7 +103,7 @@ swayc_t *remove_child(swayc_t *child) {
// Set focused to new container
if (parent->focused == child) {
if (parent->children->length > 0) {
set_focused_container_for(parent, parent->children->items[i?i-1:0]);
parent->focused = parent->children->items[i?i-1:0];
} else {
parent->focused = NULL;
}

View file

@ -182,5 +182,5 @@ void workspace_switch(swayc_t *workspace) {
}
sway_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
set_focused_container(get_focused_view(workspace));
arrange_windows(workspace, -1, -1);
arrange_windows(workspace->parent, -1, -1);
}