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:
35
src/output.c
35
src/output.c
@ -46,3 +46,38 @@ Output *get_output_from_string(Output *current_output, const char *output_str) {
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterates over all outputs and pushes sticky windows to the currently visible
|
||||
* workspace on that output.
|
||||
*
|
||||
*/
|
||||
void output_push_sticky_windows(void) {
|
||||
Con *output;
|
||||
TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
|
||||
Con *workspace, *visible_ws = NULL;
|
||||
GREP_FIRST(visible_ws, output_get_content(output), workspace_is_visible(child));
|
||||
|
||||
/* We use this loop instead of TAILQ_FOREACH to avoid problems if the
|
||||
* sticky window was the last window on that workspace as moving it in
|
||||
* this case will close the workspace. */
|
||||
for (workspace = TAILQ_FIRST(&(output_get_content(output)->nodes_head));
|
||||
workspace != TAILQ_END(&(output_get_content(output)->nodes_head));) {
|
||||
Con *current_ws = workspace;
|
||||
workspace = TAILQ_NEXT(workspace, nodes);
|
||||
|
||||
/* Since moving the windows actually removes them from the list of
|
||||
* floating windows on this workspace, here too we need to use
|
||||
* another loop than TAILQ_FOREACH. */
|
||||
Con *child;
|
||||
for (child = TAILQ_FIRST(&(current_ws->floating_head));
|
||||
child != TAILQ_END(&(current_ws->floating_head));) {
|
||||
Con *current = child;
|
||||
child = TAILQ_NEXT(child, floating_windows);
|
||||
|
||||
if (con_is_sticky(current))
|
||||
con_move_to_workspace(current, visible_ws, true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user