projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
paraslash 0.2.14
[paraslash.git]
/
gui.c
diff --git
a/gui.c
b/gui.c
index ffd1ea842039760bd6a1ec268a01423334bbb368..2513db6d4ad17746af1ece48e2b9b4a21a1efbac 100644
(file)
--- a/
gui.c
+++ b/
gui.c
@@
-31,7
+31,7
@@
INIT_GUI_ERRLISTS;
extern const char *status_item_list[NUM_STAT_ITEMS];
static char *stat_content[NUM_STAT_ITEMS];
extern const char *status_item_list[NUM_STAT_ITEMS];
static char *stat_content[NUM_STAT_ITEMS];
-#define STANDARD_STATUS_BAR "para_gui " VERSION " (hit ? for help)"
+#define STANDARD_STATUS_BAR "para_gui "
PACKAGE_
VERSION " (hit ? for help)"
static int signal_pipe;
static int signal_pipe;
@@
-56,8
+56,8
@@
void *bot_win_rb;
static unsigned scroll_position;
static unsigned scroll_position;
-static int
external_
cmd_died, curses_active;
-static pid_t
external_
cmd_pid;
+static int cmd_died, curses_active;
+static pid_t cmd_pid;
static int command_pipe = -1;
static int audiod_pipe = -1;
static int command_pipe = -1;
static int audiod_pipe = -1;
@@
-339,7
+339,7
@@
static void print_status_bar(void)
if (!curses_active)
return;
wmove(sb.win, 0, 0);
if (!curses_active)
return;
wmove(sb.win, 0, 0);
- align_str(sb.win,STANDARD_STATUS_BAR, sb.cols, CENTER);
+ align_str(sb.win,
STANDARD_STATUS_BAR, sb.cols, CENTER);
wrefresh(sb.win);
}
wrefresh(sb.win);
}
@@
-540,7
+540,7
@@
static void print_welcome(void)
int ll = conf.loglevel_arg;
if (ll > NOTICE)
return;
int ll = conf.loglevel_arg;
if (ll > NOTICE)
return;
- outputf(COLOR_WELCOME, "Welcome to para_gui " VERSION
+ outputf(COLOR_WELCOME, "Welcome to para_gui "
PACKAGE_
VERSION
" \"" CODENAME "\". Theme: %s", theme.name);
wclrtoeol(bot.win);
}
" \"" CODENAME "\". Theme: %s", theme.name);
wclrtoeol(bot.win);
}
@@
-735,9
+735,9
@@
reap_next_child:
pid = para_reap_child();
if (pid <= 0)
return;
pid = para_reap_child();
if (pid <= 0)
return;
- if (pid ==
external_
cmd_pid) {
-
external_
cmd_pid = 0;
-
external_
cmd_died = 1;
+ if (pid == cmd_pid) {
+ cmd_pid = 0;
+ cmd_died = 1;
}
goto reap_next_child;
}
}
goto reap_next_child;
}
@@
-867,7
+867,7
@@
static int open_audiod_pipe(void)
*
* EXTERNAL_MODE: Check only signal pipe. Used when an external command
* is running. During that thime curses is disabled. Returns when
*
* EXTERNAL_MODE: Check only signal pipe. Used when an external command
* is running. During that thime curses is disabled. Returns when
- *
external_
cmd_pid == 0.
+ * cmd_pid == 0.
*/
static int do_select(int mode)
{
*/
static int do_select(int mode)
{
@@
-936,6
+936,16
@@
check_return:
if (cp_numread <= 0)
cbo = 0;
wrefresh(bot.win);
if (cp_numread <= 0)
cbo = 0;
wrefresh(bot.win);
+ ret = wgetch(top.win);
+ if (ret != ERR && ret != KEY_RESIZE) {
+ if (command_pipe) {
+ close(command_pipe);
+ command_pipe = -1;
+ }
+ if (cmd_pid)
+ kill(cmd_pid, SIGTERM);
+ return -1;
+ }
break;
case GETCH_MODE:
ret = wgetch(top.win);
break;
case GETCH_MODE:
ret = wgetch(top.win);
@@
-943,8
+953,8
@@
check_return:
return ret;
break;
case EXTERNAL_MODE:
return ret;
break;
case EXTERNAL_MODE:
- if (
external_
cmd_died) {
-
external_
cmd_died = 0;
+ if (cmd_died) {
+ cmd_died = 0;
return 0;
}
}
return 0;
}
}
@@
-968,13
+978,12
@@
static int send_output(void)
static int client_cmd_cmdline(char *cmd)
{
static int client_cmd_cmdline(char *cmd)
{
- pid_t pid;
int ret, fds[3] = {0, 1, 0};
char *c = make_message(BINDIR "/para_client %s", cmd);
outputf(COLOR_COMMAND, "%s", c);
int ret, fds[3] = {0, 1, 0};
char *c = make_message(BINDIR "/para_client %s", cmd);
outputf(COLOR_COMMAND, "%s", c);
- print_in_bar(COLOR_MSG, "executing client command, hit
q
to abort\n");
- ret = para_exec_cmdline_pid(&pid, c, fds);
+ print_in_bar(COLOR_MSG, "executing client command, hit
any key
to abort\n");
+ ret = para_exec_cmdline_pid(&
cmd_
pid, c, fds);
free(c);
if (ret < 0)
return -1;
free(c);
if (ret < 0)
return -1;
@@
-987,12
+996,11
@@
static int client_cmd_cmdline(char *cmd)
*/
static int display_cmd(char *cmd)
{
*/
static int display_cmd(char *cmd)
{
- pid_t pid;
int fds[3] = {0, 1, 0};
int fds[3] = {0, 1, 0};
- print_in_bar(COLOR_MSG, "executing display command, hit
q
to abort");
+ print_in_bar(COLOR_MSG, "executing display command, hit
any key
to abort");
outputf(COLOR_COMMAND, "%s", cmd);
outputf(COLOR_COMMAND, "%s", cmd);
- if (para_exec_cmdline_pid(&pid, cmd, fds) < 0)
+ if (para_exec_cmdline_pid(&
cmd_
pid, cmd, fds) < 0)
return -1;
command_pipe = fds[1];
return send_output();
return -1;
command_pipe = fds[1];
return send_output();
@@
-1005,10
+1013,11
@@
static int external_cmd(char *cmd)
{
int fds[3] = {-1, -1, -1};
{
int fds[3] = {-1, -1, -1};
- if (
external_
cmd_pid)
+ if (cmd_pid)
return -1;
shutdown_curses();
return -1;
shutdown_curses();
- para_exec_cmdline_pid(&external_cmd_pid, cmd, fds);
+ para_exec_cmdline_pid(&cmd_pid, cmd, fds);
+ cmd_died = 0;
do_select(EXTERNAL_MODE);
init_curses();
return 0;
do_select(EXTERNAL_MODE);
init_curses();
return 0;
@@
-1224,7
+1233,8
@@
static void com_enlarge_top_win(void)
static void com_version(void)
{
static void com_version(void)
{
- print_in_bar(COLOR_MSG, "para_gui " VERSION " \"" CODENAME "\"");
+ print_in_bar(COLOR_MSG, "para_gui " PACKAGE_VERSION " \""
+ CODENAME "\"");
}
static void com_quit(void)
}
static void com_quit(void)