diff options
| author | Paul Riou <paul@mirliton.io> | 2025-03-20 20:01:36 +0000 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2025-03-20 21:31:32 +0100 |
| commit | 4b185a0fe0031455d5ceab1eda2b9d9ffe0c81de (patch) | |
| tree | 7da8f26ceeced65f548de0a8ba2489d62e8cae71 | |
| parent | d148560f50ce81bd5ca0e0f0d52c65c21f8b751d (diff) | |
stringop: fix has_prefix() arg order in config parsing
has_prefix() expects the prefix to be the 2nd argument, not the first.
The config parsing was broken when using `--input-device=`.
Introduced by: 0c60d1581f7b12ae472c786b7dfe27a1c6ec9a47 "Use has_prefix()
instead of strncmp() throughout"
| -rw-r--r-- | sway/commands/bind.c | 2 | ||||
| -rw-r--r-- | sway/commands/gesture.c | 2 | ||||
| -rw-r--r-- | swaybar/ipc.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c index 32d4f891..15373d5a 100644 --- a/sway/commands/bind.c +++ b/sway/commands/bind.c @@ -367,7 +367,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, } } else if (strcmp("--exclude-titlebar", argv[0]) == 0) { exclude_titlebar = true; - } else if (has_prefix("--input-device=", argv[0])) { + } else if (has_prefix(argv[0], "--input-device=")) { free(binding->input); binding->input = strdup(argv[0] + strlen("--input-device=")); strip_quotes(binding->input); diff --git a/sway/commands/gesture.c b/sway/commands/gesture.c index e63b7ac6..8dff29a3 100644 --- a/sway/commands/gesture.c +++ b/sway/commands/gesture.c @@ -121,7 +121,7 @@ static struct cmd_results *cmd_bind_or_unbind_gesture(int argc, char **argv, boo binding->flags |= BINDING_EXACT; } else if (strcmp("--no-warn", argv[0]) == 0) { warn = false; - } else if (has_prefix("--input-device=", argv[0])) { + } else if (has_prefix(argv[0], "--input-device=")) { free(binding->input); binding->input = strdup(argv[0] + strlen("--input-device=")); } else { diff --git a/swaybar/ipc.c b/swaybar/ipc.c index f651f035..68d8dd32 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c @@ -46,7 +46,7 @@ void ipc_send_workspace_command(struct swaybar *bar, const char *ws) { char *parse_font(const char *font) { char *new_font = NULL; - if (has_prefix("pango:", font)) { + if (has_prefix(font, "pango:")) { font += strlen("pango:"); } new_font = strdup(font); |
