mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
Fix switching focus between outputs
This commit is contained in:
parent
d5ff5e98fa
commit
f606508bcc
2 changed files with 15 additions and 4 deletions
|
@ -157,6 +157,7 @@ swayc_t *destroy_output(swayc_t *output) {
|
||||||
}
|
}
|
||||||
|
|
||||||
swayc_t *destroy_workspace(swayc_t *workspace) {
|
swayc_t *destroy_workspace(swayc_t *workspace) {
|
||||||
|
//NOTE: This is called from elsewhere without checking children length
|
||||||
//TODO move containers to other workspaces?
|
//TODO move containers to other workspaces?
|
||||||
//for now just dont delete
|
//for now just dont delete
|
||||||
if (workspace->children->length == 0) {
|
if (workspace->children->length == 0) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ swayc_t *workspace_find_by_name(const char* name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void workspace_switch(swayc_t *workspace) {
|
void workspace_switch(swayc_t *workspace) {
|
||||||
swayc_t *parent = workspace;
|
swayc_t *parent = workspace->parent;
|
||||||
while (parent->type != C_OUTPUT) {
|
while (parent->type != C_OUTPUT) {
|
||||||
parent = parent->parent;
|
parent = parent->parent;
|
||||||
}
|
}
|
||||||
|
@ -111,11 +111,21 @@ void workspace_switch(swayc_t *workspace) {
|
||||||
container_map(workspace, set_mask, &mask);
|
container_map(workspace, set_mask, &mask);
|
||||||
wlc_output_set_mask(wlc_get_focused_output(), 2);
|
wlc_output_set_mask(wlc_get_focused_output(), 2);
|
||||||
|
|
||||||
unfocus_all(&root_container);
|
|
||||||
focus_view(workspace);
|
|
||||||
|
|
||||||
destroy_workspace(c_workspace);
|
destroy_workspace(c_workspace);
|
||||||
}
|
}
|
||||||
|
unfocus_all(&root_container);
|
||||||
|
focus_view(workspace);
|
||||||
|
|
||||||
|
// focus the output this workspace is on
|
||||||
|
swayc_t *output = workspace->parent;
|
||||||
|
sway_log(L_DEBUG, "Switching focus to output %p (%d)", output, output->type);
|
||||||
|
while (output && output->type != C_OUTPUT) {
|
||||||
|
output = output->parent;
|
||||||
|
}
|
||||||
|
if (output) {
|
||||||
|
sway_log(L_DEBUG, "Switching focus to output %p (%d)", output, output->type);
|
||||||
|
wlc_output_focus(output->handle);
|
||||||
|
}
|
||||||
active_workspace = workspace;
|
active_workspace = workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue