diff options
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/blur.c | 31 | ||||
-rw-r--r-- | sway/commands/blur_passes.c | 28 | ||||
-rw-r--r-- | sway/commands/blur_radius.c | 28 | ||||
-rw-r--r-- | sway/commands/blur_xray.c | 25 |
4 files changed, 112 insertions, 0 deletions
diff --git a/sway/commands/blur.c b/sway/commands/blur.c new file mode 100644 index 00000000..15dd985d --- /dev/null +++ b/sway/commands/blur.c @@ -0,0 +1,31 @@ +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/output.h" +#include "util.h" + +struct cmd_results *cmd_blur(int argc, char **argv) { + struct cmd_results *error = checkarg(argc, "blur", EXPECTED_AT_LEAST, 1); + + if (error) { + return error; + } + + struct sway_container *con = config->handler_context.container; + + bool result = parse_boolean(argv[0], config->blur_enabled); + if (con == NULL) { + config->blur_enabled = result; + } else { + con->blur_enabled = result; + } + + struct sway_output *output; + wl_list_for_each(output, &root->all_outputs, link) { + if (output->renderer) { + output->renderer->blur_buffer_dirty = true; + output_damage_whole(output); + } + } + + return cmd_results_new(CMD_SUCCESS, NULL); +} diff --git a/sway/commands/blur_passes.c b/sway/commands/blur_passes.c new file mode 100644 index 00000000..0868a568 --- /dev/null +++ b/sway/commands/blur_passes.c @@ -0,0 +1,28 @@ +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/output.h" + +struct cmd_results *cmd_blur_passes(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "blur_passes", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + char *inv; + int value = strtol(argv[0], &inv, 10); + if (*inv != '\0' || value < 0 || value > 10) { + return cmd_results_new(CMD_FAILURE, "Invalid size specified"); + } + + config->blur_params.num_passes = value; + + struct sway_output *output; + wl_list_for_each(output, &root->all_outputs, link) { + if (output->renderer) { + output->renderer->blur_buffer_dirty = true; + output_damage_whole(output); + } + } + + return cmd_results_new(CMD_SUCCESS, NULL); +} diff --git a/sway/commands/blur_radius.c b/sway/commands/blur_radius.c new file mode 100644 index 00000000..f6e7d4ed --- /dev/null +++ b/sway/commands/blur_radius.c @@ -0,0 +1,28 @@ +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/output.h" + +struct cmd_results *cmd_blur_radius(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "blur_radius", EXPECTED_AT_LEAST, 1))) { + return error; + } + + char *inv; + int value = strtol(argv[0], &inv, 10); + if (*inv != '\0' || value < 0 || value > 10) { + return cmd_results_new(CMD_FAILURE, "Invalid size specified"); + } + + config->blur_params.radius = value; + + struct sway_output *output; + wl_list_for_each(output, &root->all_outputs, link) { + if (output->renderer) { + output->renderer->blur_buffer_dirty = true; + output_damage_whole(output); + } + } + + return cmd_results_new(CMD_SUCCESS, NULL); +} diff --git a/sway/commands/blur_xray.c b/sway/commands/blur_xray.c new file mode 100644 index 00000000..045566d0 --- /dev/null +++ b/sway/commands/blur_xray.c @@ -0,0 +1,25 @@ +#include "sway/commands.h" +#include "sway/config.h" +#include "sway/output.h" +#include "util.h" + +struct cmd_results *cmd_blur_xray(int argc, char **argv) { + struct cmd_results *error = checkarg(argc, "blur_xray", EXPECTED_AT_LEAST, 1); + + if (error) { + return error; + } + + bool result = parse_boolean(argv[0], config->blur_xray); + config->blur_xray = result; + + struct sway_output *output; + wl_list_for_each(output, &root->all_outputs, link) { + if (output->renderer) { + output->renderer->blur_buffer_dirty = true; + output_damage_whole(output); + } + } + + return cmd_results_new(CMD_SUCCESS, NULL); +} |