diff options
author | Kalle Wallin <kaw@linux.se> | 2004-06-09 17:17:31 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-06-09 17:17:31 +0000 |
commit | e02744ca319e76a078bf91316d0f088e3b06cc24 (patch) | |
tree | 60b94f8a15c7e6d38b4c8d4a45fe9edf87ac378f /src | |
parent | b52e7e0365fe17ccf526f7c355ce6247cf44f919 (diff) | |
download | mpd-e02744ca319e76a078bf91316d0f088e3b06cc24.tar.gz mpd-e02744ca319e76a078bf91316d0f088e3b06cc24.tar.xz mpd-e02744ca319e76a078bf91316d0f088e3b06cc24.zip |
Added the get_keyboard_command_with_timeout() function.
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r-- | src/command.c | 17 | ||||
-rw-r--r-- | src/command.h | 1 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/command.c b/src/command.c index 294f2318b..81eec77f7 100644 --- a/src/command.c +++ b/src/command.c @@ -158,7 +158,7 @@ static command_definition_t cmds[] = N_("Key configuration screen") }, #endif - { { 'q', 0, 0 }, CMD_QUIT, "quit", + { { 'q', 'Q', 3 }, CMD_QUIT, "quit", N_("Quit") }, { { -1, -1, -1 }, CMD_NONE, NULL, NULL } @@ -345,13 +345,16 @@ get_key_command(int key) return find_key_command(key, cmds); } - command_t -get_keyboard_command(void) +get_keyboard_command_with_timeout(int ms) { int key; + if( ms != SCREEN_TIMEOUT) + timeout(ms); key = wgetch(stdscr); + if( ms != SCREEN_TIMEOUT) + timeout(SCREEN_TIMEOUT); if( key==KEY_RESIZE ) screen_resize(); @@ -359,11 +362,15 @@ get_keyboard_command(void) if( key==ERR ) return CMD_NONE; - DK(fprintf(stderr, "key = 0x%02X\t", key)); - return get_key_command(key); } +command_t +get_keyboard_command(void) +{ + return get_keyboard_command_with_timeout(SCREEN_TIMEOUT); +} + int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]) { diff --git a/src/command.h b/src/command.h index 9c20acb7a..9fd6ab37b 100644 --- a/src/command.h +++ b/src/command.h @@ -74,5 +74,6 @@ command_t get_key_command_from_name(char *name); int assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]); command_t get_keyboard_command(void); +command_t get_keyboard_command_with_timeout(int milliseconds); #endif |