summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-04-21 15:18:07 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-04-21 15:18:07 +0000
commita5599493383f51dd1b4a68e067443642f8448bdc (patch)
tree20b725e5438817d8d58e83122a38c851e38fded8 /usr.bin/tmux
parentae90fea4a47ec7d6df8952834dc5dff38ea3b1aa (diff)
Pass mouse events through to commands for if-shell.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cmd-if-shell.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index e19d4c449fe..857d8629be1 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.29 2015/04/19 21:34:21 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.30 2015/04/21 15:18:06 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -44,11 +44,14 @@ const struct cmd_entry cmd_if_shell_entry = {
};
struct cmd_if_shell_data {
- char *cmd_if;
- char *cmd_else;
- struct cmd_q *cmdq;
- int bflag;
- int started;
+ char *cmd_if;
+ char *cmd_else;
+
+ struct cmd_q *cmdq;
+ struct mouse_event mouse;
+
+ int bflag;
+ int started;
};
enum cmd_retval
@@ -95,21 +98,24 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
}
return (CMD_RETURN_ERROR);
}
- cmdq_run(cmdq, cmdlist, NULL);
+ cmdq_run(cmdq, cmdlist, &cmdq->item->mouse);
cmd_list_free(cmdlist);
return (CMD_RETURN_NORMAL);
}
cdata = xmalloc(sizeof *cdata);
+
cdata->cmd_if = xstrdup(args->argv[1]);
if (args->argc == 3)
cdata->cmd_else = xstrdup(args->argv[2]);
else
cdata->cmd_else = NULL;
+
cdata->bflag = args_has(args, 'b');
cdata->started = 0;
cdata->cmdq = cmdq;
+ memcpy(&cdata->mouse, &cmdq->item->mouse, sizeof cdata->mouse);
cmdq->references++;
job_run(shellcmd, s, cmd_if_shell_callback, cmd_if_shell_free, cdata);
@@ -152,7 +158,7 @@ cmd_if_shell_callback(struct job *job)
cmdq1->emptyfn = cmd_if_shell_done;
cmdq1->data = cdata;
- cmdq_run(cmdq1, cmdlist, NULL);
+ cmdq_run(cmdq1, cmdlist, &cdata->mouse);
cmd_list_free(cmdlist);
}