mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 09:21:28 +00:00
2a684cad5f
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
26 lines
801 B
C
26 lines
801 B
C
#include "sway/commands.h"
|
|
|
|
struct cmd_results *cmd_focus_on_window_activation(int argc, char **argv) {
|
|
struct cmd_results *error = NULL;
|
|
if ((error = checkarg(argc, "focus_on_window_activation",
|
|
EXPECTED_EQUAL_TO, 1))) {
|
|
return error;
|
|
}
|
|
|
|
if (strcmp(argv[0], "smart") == 0) {
|
|
config->focus_on_window_activation = FOWA_SMART;
|
|
} else if (strcmp(argv[0], "urgent") == 0) {
|
|
config->focus_on_window_activation = FOWA_URGENT;
|
|
} else if (strcmp(argv[0], "focus") == 0) {
|
|
config->focus_on_window_activation = FOWA_FOCUS;
|
|
} else if (strcmp(argv[0], "none") == 0) {
|
|
config->focus_on_window_activation = FOWA_NONE;
|
|
} else {
|
|
return cmd_results_new(CMD_INVALID,
|
|
"Expected "
|
|
"'focus_on_window_activation smart|urgent|focus|none'");
|
|
}
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
}
|