summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0185119)
raw | patch | inline | side by side (parent: 0185119)
author | Max Kellermann <max.kellermann@gmail.com> | |
Sun, 19 Mar 2017 10:04:08 +0000 (11:04 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Sun, 19 Mar 2017 10:04:08 +0000 (11:04 +0100) |
src/keyboard.c | patch | blob | history | |
src/lirc.c | patch | blob | history | |
src/main.c | patch | blob | history | |
src/ncmpc.h | patch | blob | history |
diff --git a/src/keyboard.c b/src/keyboard.c
index 226306cf7543fc1823fb167b115baa2ad54f7c03..5bd43e573ab3e173b26542ccbf676418068cf778 100644 (file)
--- a/src/keyboard.c
+++ b/src/keyboard.c
command_t cmd = get_keyboard_command();
if (cmd != CMD_NONE)
- if (do_input_event(cmd) != 0)
+ if (!do_input_event(cmd))
return FALSE;
end_input_event();
diff --git a/src/lirc.c b/src/lirc.c
index ce8f92891345fc24d509cfa040637b6d01bb879e..965037bd23f94e8304b85278f4ecbce236b05001 100644 (file)
--- a/src/lirc.c
+++ b/src/lirc.c
if (lirc_nextcode(&code) == 0) {
while (lirc_code2char(lc, code, &txt) == 0 && txt != NULL) {
cmd = get_key_command_from_name(txt);
- if (do_input_event(cmd) != 0)
+ if (!do_input_event(cmd))
return FALSE;
}
}
diff --git a/src/main.c b/src/main.c
index fe696c400ce61d5e91d79f5283335b2fc1f04001..47a5670cef21e810a063d487e017678ddf93b306 100644 (file)
--- a/src/main.c
+++ b/src/main.c
auto_update_timer();
}
-int do_input_event(command_t cmd)
+bool
+do_input_event(command_t cmd)
{
if (cmd == CMD_QUIT) {
g_main_loop_quit(main_loop);
- return -1;
+ return false;
}
screen_cmd(mpd, cmd);
/* make sure we don't update the volume yet */
disable_update_timer();
- return 0;
+ return true;
}
#ifndef NCMPC_MINI
diff --git a/src/ncmpc.h b/src/ncmpc.h
index a2f3aed4910c793075816ab29b036ac24bbccc79..5ac3ce5a5406e36e7564621b85c571d5ba8ac8a1 100644 (file)
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
#include "command.h"
+#include <stdbool.h>
+
/** put the terminal in a sane mode and stop/suspend ncmpc */
void
sigstop(void);
void begin_input_event(void);
void end_input_event(void);
-int do_input_event(command_t cmd);
+
+/**
+ * @return false if the application shall quit
+ */
+bool
+do_input_event(command_t cmd);
#endif /* NCMPC_H */