summaryrefslogtreecommitdiffstats
path: root/sway/commands/output/scale_filter.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/output/scale_filter.c')
-rw-r--r--sway/commands/output/scale_filter.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sway/commands/output/scale_filter.c b/sway/commands/output/scale_filter.c
new file mode 100644
index 00000000..fa1e8e0d
--- /dev/null
+++ b/sway/commands/output/scale_filter.c
@@ -0,0 +1,34 @@
1#include <string.h>
2#include "log.h"
3#include "sway/commands.h"
4#include "sway/config.h"
5#include "sway/output.h"
6
7struct cmd_results *output_cmd_scale_filter(int argc, char **argv) {
8 if (!config->handler_context.output_config) {
9 return cmd_results_new(CMD_FAILURE, "Missing output config");
10 }
11
12 if (!argc) {
13 return cmd_results_new(CMD_INVALID, "Missing scale_filter argument.");
14 }
15
16
17 enum scale_filter_mode scale_filter;
18 if (strcmp(*argv, "linear") == 0) {
19 scale_filter = SCALE_FILTER_LINEAR;
20 } else if (strcmp(*argv, "nearest") == 0) {
21 scale_filter = SCALE_FILTER_NEAREST;
22 } else if (strcmp(*argv, "smart") == 0) {
23 scale_filter = SCALE_FILTER_SMART;
24 } else {
25 return cmd_results_new(CMD_INVALID, "Invalid output scale_filter.");
26 }
27
28 struct output_config *oc = config->handler_context.output_config;
29 config->handler_context.leftovers.argc = argc - 1;
30 config->handler_context.leftovers.argv = argv + 1;
31
32 oc->scale_filter = scale_filter;
33 return NULL;
34}