X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Fclient%2Fkeybindings.c;h=fc371e866501f7caf9777f021cda9aa2a074e1df;hb=a6fd795234fd4e4f9aebcfdc1771afd22c3c9c23;hp=b0b7c7a06fc496ee5cb9baa5cd5af8c70632d14a;hpb=778534bf6946fe0fef17e353c55678d248d8d09d;p=plomrogue
diff --git a/src/client/keybindings.c b/src/client/keybindings.c
index b0b7c7a..fc371e8 100644
--- a/src/client/keybindings.c
+++ b/src/client/keybindings.c
@@ -1,7 +1,12 @@
-/* src/client/keybindings.c */
+/* src/client/keybindings.c
+ *
+ * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
+ * or any later version. For details on its copyright, license, and warranties,
+ * see the file NOTICE in the root directory of the PlomRogue source package.
+ */
#include "keybindings.h"
-#include /* keycode defines, cbreak(), halfdelay(), getch() */
+#include /* keycode defines, cbreak(), getch(), timeout() */
#include /* NULL */
#include /* uint8_t, uint16_t, uint32_t */
#include /* FILE, sprintf() */
@@ -50,11 +55,10 @@ static struct KeyBindingDB * char_selected_kb_db(char c)
static uint8_t try_keycode(uint16_t keycode_given, char * keyname,
uint16_t keycode_match, char * keyname_match)
{
- char * f_name = "try_keycode()";
if (keycode_given == keycode_match)
{
int test = sprintf(keyname, "%s", keyname_match);
- exit_trouble(test < 0, f_name, "sprintf()");
+ exit_trouble(test < 0, __func__, "sprintf");
return 1;
}
return 0;
@@ -80,16 +84,15 @@ extern struct Command * get_command_to_keycode(struct KeyBindingDB * kbdb,
extern char * get_keyname_to_keycode(uint16_t keycode)
{
- char * f_name = "get_name_to_keycode()";
- char * keyname = try_malloc(10, f_name); /* max keyname length + 1 */
+ char * keyname = try_malloc(10, __func__); /* max keyname length + 1 */
if (32 < keycode && keycode < 127)
{
- exit_trouble(sprintf(keyname, "%c", keycode) < 0, f_name, "sprintf()");
+ exit_trouble(sprintf(keyname, "%c", keycode) < 0, __func__, "sprintf");
}
else if (keycode >= KEY_F0 && keycode <= KEY_F(63))
{
uint16_t f = keycode - KEY_F0;
- exit_trouble(sprintf(keyname, "F%d", f) < 0, f_name, "sprintf()");;
+ exit_trouble(sprintf(keyname, "F%d", f) < 0, __func__, "sprintf");;
}
else if ( try_keycode(keycode, keyname, 9, "TAB")
|| try_keycode(keycode, keyname, 10, "RETURN")
@@ -111,7 +114,7 @@ extern char * get_keyname_to_keycode(uint16_t keycode)
}
else
{
- exit_trouble(sprintf(keyname, "(unknown)") < 0, f_name, "sprintf()");
+ exit_trouble(sprintf(keyname, "(unknown)") < 0, __func__, "sprintf");
}
return keyname;
}
@@ -124,8 +127,9 @@ extern void mod_selected_keyb(char kb_c)
kbdb->edit = 1;
draw_all_wins();
cbreak();
+ timeout(-1);
int keycode = getch();
- halfdelay(world.halfdelay);
+ timeout(0);
if (keycode < 1000)
{
kbdb->kbs[kbdb->select].keycode = keycode;