GTK+: Fix key bindings with spaces.

This commit is contained in:
Brandon Wright 2019-01-24 15:39:57 -06:00
parent d1e078e570
commit 30c50f4fc4
1 changed files with 8 additions and 7 deletions

View File

@ -193,7 +193,10 @@ Binding::Binding (const char *raw_string)
key = strtok (NULL, "+"); key = strtok (NULL, "+");
} }
if (keyval != GDK_KEY_VoidSymbol)
value = Binding(keyval, ctrl, shift, alt).value; value = Binding(keyval, ctrl, shift, alt).value;
else
value = 0;
} }
else if (!strncmp (raw_string, "Joystick", 8)) else if (!strncmp (raw_string, "Joystick", 8))
{ {
@ -220,7 +223,6 @@ void
Binding::to_string (char *str, bool translate) Binding::to_string (char *str, bool translate)
{ {
char buf[256]; char buf[256];
char *c;
#undef _ #undef _
#define _(String) translate ? gettext(String) : (String) #define _(String) translate ? gettext(String) : (String)
@ -237,7 +239,6 @@ Binding::to_string (char *str, bool translate)
{ {
sprintf (buf, _("Unknown")); sprintf (buf, _("Unknown"));
} }
else else
{ {
memset (buf, 0, 256); memset (buf, 0, 256);
@ -246,10 +247,10 @@ Binding::to_string (char *str, bool translate)
255); 255);
} }
while ((c = strstr (buf, "_"))) if (translate)
{ for (int i = 0; buf[i]; i++)
*c = ' '; if (buf[i] == '_')
} buf[i] = ' ';
sprintf (str, _("Keyboard %s%s%s%s"), sprintf (str, _("Keyboard %s%s%s%s"),
(value & BINDING_SHIFT) ? "Shift+" : "", (value & BINDING_SHIFT) ? "Shift+" : "",