sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 4b185a0fe0031455d5ceab1eda2b9d9ffe0c81de
parent d148560f50ce81bd5ca0e0f0d52c65c21f8b751d
Author: Paul Riou <paul@mirliton.io>
Date:   Thu, 20 Mar 2025 20:01:36 +0000

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"

Diffstat:
Msway/commands/bind.c | 2+-
Msway/commands/gesture.c | 2+-
Mswaybar/ipc.c | 2+-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git 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 @@ -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 @@ -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);