don’t close workspaces which are still visible (multi-monitor)
This commit is contained in:
parent
c1d574f84e
commit
c6c084faa5
@ -34,6 +34,7 @@ Con *workspace_get(const char *num);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void workspace_set_name(Workspace *ws, const char *name);
|
void workspace_set_name(Workspace *ws, const char *name);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the workspace is currently visible. Especially important for
|
* Returns true if the workspace is currently visible. Especially important for
|
||||||
@ -41,9 +42,8 @@ void workspace_set_name(Workspace *ws, const char *name);
|
|||||||
* workspaces.
|
* workspaces.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool workspace_is_visible(Workspace *ws);
|
bool workspace_is_visible(Con *ws);
|
||||||
|
|
||||||
#endif
|
|
||||||
/** Switches to the given workspace */
|
/** Switches to the given workspace */
|
||||||
void workspace_show(const char *num);
|
void workspace_show(const char *num);
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ void workspace_set_name(Workspace *ws, const char *name) {
|
|||||||
else ws->text_width = 0;
|
else ws->text_width = 0;
|
||||||
ws->utf8_name = label;
|
ws->utf8_name = label;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true if the workspace is currently visible. Especially important for
|
* Returns true if the workspace is currently visible. Especially important for
|
||||||
@ -87,10 +88,14 @@ void workspace_set_name(Workspace *ws, const char *name) {
|
|||||||
* workspaces.
|
* workspaces.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool workspace_is_visible(Workspace *ws) {
|
bool workspace_is_visible(Con *ws) {
|
||||||
return (ws->output != NULL && ws->output->current_workspace == ws);
|
Con *output = con_get_output(ws);
|
||||||
|
if (output == NULL)
|
||||||
|
return false;
|
||||||
|
Con *fs = con_get_fullscreen_con(output);
|
||||||
|
LOG("workspace visible? fs = %p, ws = %p\n", fs, ws);
|
||||||
|
return (fs == ws);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: we need to clean up all this recursive walking code.
|
* XXX: we need to clean up all this recursive walking code.
|
||||||
@ -197,9 +202,12 @@ void workspace_show(const char *num) {
|
|||||||
|
|
||||||
|
|
||||||
if (TAILQ_EMPTY(&(old->nodes_head))) {
|
if (TAILQ_EMPTY(&(old->nodes_head))) {
|
||||||
|
/* check if this workspace is currently visible */
|
||||||
|
if (!workspace_is_visible(old)) {
|
||||||
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
|
LOG("Closing old workspace (%p / %s), it is empty\n", old, old->name);
|
||||||
tree_close(old, false);
|
tree_close(old, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
con_focus(next);
|
con_focus(next);
|
||||||
workspace->fullscreen_mode = CF_OUTPUT;
|
workspace->fullscreen_mode = CF_OUTPUT;
|
||||||
|
Loading…
Reference in New Issue
Block a user