mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-17 17:11:38 +02:00
Add notification for input from a pane, from George Nachman.
This commit is contained in:
@ -24,6 +24,35 @@
|
||||
#define CONTROL_SHOULD_NOTIFY_CLIENT(c) \
|
||||
((c) != NULL && ((c)->flags & CLIENT_CONTROL))
|
||||
|
||||
void
|
||||
control_notify_input(struct client *c, struct window_pane *wp,
|
||||
struct evbuffer *input)
|
||||
{
|
||||
u_char *buf;
|
||||
size_t len;
|
||||
struct evbuffer *message;
|
||||
u_int i;
|
||||
|
||||
if (c->session == NULL)
|
||||
return;
|
||||
|
||||
buf = EVBUFFER_DATA(input);
|
||||
len = EVBUFFER_LENGTH(input);
|
||||
|
||||
/*
|
||||
* Only write input if the window pane is linked to a window belonging
|
||||
* to the client's session.
|
||||
*/
|
||||
if (winlink_find_by_window(&c->session->windows, wp->window) != NULL) {
|
||||
message = evbuffer_new();
|
||||
evbuffer_add_printf(message, "%%output %%%u ", wp->id);
|
||||
for (i = 0; i < len; i++)
|
||||
evbuffer_add_printf(message, "%02hhx", buf[i]);
|
||||
control_write_buffer(c, message);
|
||||
evbuffer_free(message);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
control_notify_window_layout_changed(struct window *w)
|
||||
{
|
||||
|
Reference in New Issue
Block a user