swayfx/sway/commands/blur_passes.c
Erik Reider cbfb7af7fd
Add kawase blur (#120)
Co-authored-by: Erik Reider <erik.reider@protonmail.com>
Co-authored-by: Will McKinnon <contact@willmckinnon.com>
2023-04-17 23:24:48 +02:00

29 lines
717 B
C

#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);
}