aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/output
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-01-20 10:50:11 +1000
committerLibravatar emersion <contact@emersion.fr>2019-01-22 09:55:13 +0100
commit75e7ce82f5a28693b4e559797c8606c528d61892 (patch)
tree976aaed15b9e5113e77ddb73541a34e438128659 /sway/commands/output
parentUse noop output when there's no outputs connected (diff)
downloadsway-75e7ce82f5a28693b4e559797c8606c528d61892.tar.gz
sway-75e7ce82f5a28693b4e559797c8606c528d61892.tar.zst
sway-75e7ce82f5a28693b4e559797c8606c528d61892.zip
Prevent noop output from being enabled
Diffstat (limited to 'sway/commands/output')
-rw-r--r--sway/commands/output/enable.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sway/commands/output/enable.c b/sway/commands/output/enable.c
index 71a7d75a..0c98b481 100644
--- a/sway/commands/output/enable.c
+++ b/sway/commands/output/enable.c
@@ -1,3 +1,4 @@
1#include <strings.h>
1#include "sway/commands.h" 2#include "sway/commands.h"
2#include "sway/config.h" 3#include "sway/config.h"
3 4
@@ -5,6 +6,15 @@ struct cmd_results *output_cmd_enable(int argc, char **argv) {
5 if (!config->handler_context.output_config) { 6 if (!config->handler_context.output_config) {
6 return cmd_results_new(CMD_FAILURE, "Missing output config"); 7 return cmd_results_new(CMD_FAILURE, "Missing output config");
7 } 8 }
9
10 // The NOOP-1 output is a dummy output used when there's no outputs
11 // connected. It should never be enabled.
12 char *output_name = config->handler_context.output_config->name;
13 if (strcasecmp(output_name, "NOOP-1") == 0) {
14 return cmd_results_new(CMD_FAILURE,
15 "Refusing to enable the no op output");
16 }
17
8 config->handler_context.output_config->enabled = 1; 18 config->handler_context.output_config->enabled = 1;
9 19
10 config->handler_context.leftovers.argc = argc; 20 config->handler_context.leftovers.argc = argc;