From 7f8ea60e71d3185f47954844d9e974bdb49b0c41 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 20 Jan 2019 19:05:28 +1000 Subject: Don't allow noop output to be configured --- sway/commands/output.c | 8 ++++++++ sway/commands/output/enable.c | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'sway/commands') diff --git a/sway/commands/output.c b/sway/commands/output.c index 74ca9d0b..85b7fd23 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -1,3 +1,4 @@ +#include #include "sway/commands.h" #include "sway/config.h" #include "sway/output.h" @@ -26,6 +27,13 @@ struct cmd_results *cmd_output(int argc, char **argv) { return error; } + // The NOOP-1 output is a dummy output used when there's no outputs + // connected. It should never be configured. + if (strcasecmp(argv[0], "NOOP-1") == 0) { + return cmd_results_new(CMD_FAILURE, + "Refusing to configure the no op output"); + } + struct output_config *output = new_output_config(argv[0]); if (!output) { sway_log(SWAY_ERROR, "Failed to allocate output config"); diff --git a/sway/commands/output/enable.c b/sway/commands/output/enable.c index 0c98b481..bae3961f 100644 --- a/sway/commands/output/enable.c +++ b/sway/commands/output/enable.c @@ -1,4 +1,3 @@ -#include #include "sway/commands.h" #include "sway/config.h" @@ -7,14 +6,6 @@ struct cmd_results *output_cmd_enable(int argc, char **argv) { return cmd_results_new(CMD_FAILURE, "Missing output config"); } - // The NOOP-1 output is a dummy output used when there's no outputs - // connected. It should never be enabled. - char *output_name = config->handler_context.output_config->name; - if (strcasecmp(output_name, "NOOP-1") == 0) { - return cmd_results_new(CMD_FAILURE, - "Refusing to enable the no op output"); - } - config->handler_context.output_config->enabled = 1; config->handler_context.leftovers.argc = argc; -- cgit v1.2.3-54-g00ecf