Make sure sticky windows pop to the front if they get sticky while not being on a visible workspace.

This commit also reworks the way focusing sticky windows is prevented by not focusing them temporarily at all, but preventing the focus in the first place.
This commit is contained in:
Ingo Bürk
2015-08-26 21:06:53 +02:00
parent 23a1dadaae
commit 1c4c3f06fa
10 changed files with 94 additions and 59 deletions

View File

@ -451,44 +451,8 @@ static void _workspace_show(Con *workspace) {
/* Update the EWMH hints */
ewmh_update_current_desktop();
/* Floating containers which are sticky need to be moved to the new workspace,
* but only on the same output. */
if (current != NULL && old_output == new_output) {
Con *prev = focused;
Con *child;
/* We can't simply iterate over the floating containers since moving a
* sticky container to the target workspace will modify that list.
* Instead, we first count the number of sticky containers, then memorize
* all of them and finally loop over that list to move them to the new
* workspace. */
int num_sticky = 0;
TAILQ_FOREACH(child, &(current->floating_head), floating_windows) {
if (con_is_sticky(child))
num_sticky++;
}
Con *sticky_cons[num_sticky];
int ctr = 0;
TAILQ_FOREACH(child, &(current->floating_head), floating_windows) {
if (con_is_sticky(child))
sticky_cons[ctr++] = child;
}
for (int i = 0; i < num_sticky; i++) {
con_move_to_workspace(sticky_cons[i], workspace, true, false);
/* We want sticky containers to be at the end of the focus head. */
TAILQ_REMOVE(&(workspace->focus_head), sticky_cons[i], focused);
TAILQ_INSERT_TAIL(&(workspace->focus_head), sticky_cons[i], focused);
}
/* Focus the correct container since moving the sticky containers
* changed the focus. However, if no container was focused before,
* we can leave the focus at the sticky container. */
if (prev != croot)
con_focus(prev);
}
/* Push any sticky windows to the now visible workspace. */
output_push_sticky_windows();
}
/*