Deny moving a sticky container to workspace if it's the same output

Rationale: Sticky containers are always assigned to the visible
workspace.

The basic idea here is to check the destination's output (move.c:190).
But if the command was `move container to workspace x` then a workspace
might have been created for it. We could destroy the workspace in this
case, but that results in unnecessary IPC events.

To avoid this, the logic for `move container to workspace x` has been
adjusted. It now delays creating the workspace until the end, and uses
`workspace_get_initial_output` to determine and check the output before
creating it.
This commit is contained in:
Ryan Dwyer 2018-08-08 10:04:11 +10:00
parent a0649190de
commit 5653fc754b
3 changed files with 36 additions and 10 deletions

View file

@ -18,7 +18,7 @@
#include "log.h"
#include "util.h"
static struct sway_container *get_workspace_initial_output(const char *name) {
struct sway_container *workspace_get_initial_output(const char *name) {
struct sway_container *parent;
// Search for workspace<->output pair
int e = config->workspace_outputs->length;
@ -48,7 +48,7 @@ static struct sway_container *get_workspace_initial_output(const char *name) {
struct sway_container *workspace_create(struct sway_container *output,
const char *name) {
if (output == NULL) {
output = get_workspace_initial_output(name);
output = workspace_get_initial_output(name);
}
wlr_log(WLR_DEBUG, "Added workspace %s for output %s", name, output->name);