Skip to content

Commit

Permalink
Dont use strcasestr for parsing settings
Browse files Browse the repository at this point in the history
Apparently this is not available on Windows.  For now I just disable it
and we need to keep the keymap settings lowercase.
  • Loading branch information
guillaumechereau committed Jul 11, 2024
1 parent b880f34 commit f278847
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/gui/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ static void add_keymap(const char *name, const char *value)
if (strcmp(name, "rotate") == 0) keymap.action = 1;
if (strcmp(name, "zoom") == 0) keymap.action = 2;

if (strcasestr(value, "right mouse")) keymap.input |= GESTURE_RMB;
if (strcasestr(value, "middle mouse")) keymap.input |= GESTURE_MMB;
if (strcasestr(value, "shift")) keymap.input |= GESTURE_SHIFT;
if (strcasestr(value, "ctrl")) keymap.input |= GESTURE_CTRL;
if (strstr(value, "right mouse")) keymap.input |= GESTURE_RMB;
if (strstr(value, "middle mouse")) keymap.input |= GESTURE_MMB;
if (strstr(value, "shift")) keymap.input |= GESTURE_SHIFT;
if (strstr(value, "ctrl")) keymap.input |= GESTURE_CTRL;

if (keymap.action == -1 || keymap.input == 0) {
LOG_W("Cannot parse keymap %s = %s", name, value);
Expand Down Expand Up @@ -279,16 +279,16 @@ static void save_keymaps(FILE *file)
break;
}
if (input & GESTURE_CTRL) {
fprintf(file, "Ctrl ");
fprintf(file, "ctrl ");
}
if (input & GESTURE_SHIFT) {
fprintf(file, "Shift ");
fprintf(file, "shift ");
}
if (input & GESTURE_MMB) {
fprintf(file, "Middle Mouse");
fprintf(file, "middle mouse");
}
if (input & GESTURE_RMB) {
fprintf(file, "Right Mouse");
fprintf(file, "right mouse");
}
fprintf(file, "\n");
}
Expand Down

0 comments on commit f278847

Please sign in to comment.