aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/tree/workspace.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index ee940466..18218768 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -176,22 +176,16 @@ void workspace_consider_destroy(struct sway_workspace *ws) {
static bool workspace_valid_on_output(const char *output_name,
const char *ws_name) {
struct workspace_config *wsc = workspace_find_config(ws_name);
- char identifier[128];
struct sway_output *output = output_by_name_or_id(output_name);
if (!output) {
return false;
}
- output_name = output->wlr_output->name;
- output_get_identifier(identifier, sizeof(identifier), output);
-
if (!wsc) {
return true;
}
for (int i = 0; i < wsc->outputs->length; i++) {
- if (strcmp(wsc->outputs->items[i], "*") == 0 ||
- strcmp(wsc->outputs->items[i], output_name) == 0 ||
- strcmp(wsc->outputs->items[i], identifier) == 0) {
+ if (output_match_name_or_id(output, wsc->outputs->items[i])) {
return true;
}
}
@@ -286,13 +280,10 @@ char *workspace_next_name(const char *output_name) {
// assignments primarily, falling back to bindings and numbers.
struct sway_mode *mode = config->current_mode;
- char identifier[128];
struct sway_output *output = output_by_name_or_id(output_name);
if (!output) {
return NULL;
}
- output_name = output->wlr_output->name;
- output_get_identifier(identifier, sizeof(identifier), output);
int order = INT_MAX;
char *target = NULL;
@@ -312,9 +303,7 @@ char *workspace_next_name(const char *output_name) {
}
bool found = false;
for (int j = 0; j < wsc->outputs->length; ++j) {
- if (strcmp(wsc->outputs->items[j], "*") == 0 ||
- strcmp(wsc->outputs->items[j], output_name) == 0 ||
- strcmp(wsc->outputs->items[j], identifier) == 0) {
+ if (output_match_name_or_id(output, wsc->outputs->items[j])) {
found = true;
free(target);
target = strdup(wsc->workspace);
@@ -654,15 +643,9 @@ void workspace_output_add_priority(struct sway_workspace *workspace,
struct sway_output *workspace_output_get_highest_available(
struct sway_workspace *ws, struct sway_output *exclude) {
- char exclude_id[128] = {'\0'};
- if (exclude) {
- output_get_identifier(exclude_id, sizeof(exclude_id), exclude);
- }
-
for (int i = 0; i < ws->output_priority->length; i++) {
- char *name = ws->output_priority->items[i];
- if (exclude && (strcmp(name, exclude->wlr_output->name) == 0
- || strcmp(name, exclude_id) == 0)) {
+ const char *name = ws->output_priority->items[i];
+ if (exclude && output_match_name_or_id(exclude, name)) {
continue;
}