aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-03-09 18:01:16 +0000
committerThomas Adam <thomas@xteddy.org>2017-03-09 18:01:16 +0000
commitc5bdae466e4dad6c185fa5146b11275b6119ff24 (patch)
tree05536631ebb8c314a3026748c2b20753594cc5af /server-client.c
parentfd96ccfd802aec27a4835f7bb2030003b9668e64 (diff)
parentbce1dee0341b3624d927d393fd0f21771660d5ed (diff)
downloadrtmux-c5bdae466e4dad6c185fa5146b11275b6119ff24.tar.gz
rtmux-c5bdae466e4dad6c185fa5146b11275b6119ff24.tar.bz2
rtmux-c5bdae466e4dad6c185fa5146b11275b6119ff24.zip
Merge branch 'obsd-master'
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/server-client.c b/server-client.c
index 1f64ac4a..d7bbd806 100644
--- a/server-client.c
+++ b/server-client.c
@@ -47,6 +47,49 @@ static void server_client_dispatch_command(struct client *, struct imsg *);
static void server_client_dispatch_identify(struct client *, struct imsg *);
static void server_client_dispatch_shell(struct client *);
+/* Idenfity mode callback. */
+static void
+server_client_callback_identify(__unused int fd, __unused short events, void *data)
+{
+ server_client_clear_identify(data, NULL);
+}
+
+/* Set identify mode on client. */
+void
+server_client_set_identify(struct client *c)
+{
+ struct timeval tv;
+ int delay;
+
+ delay = options_get_number(c->session->options, "display-panes-time");
+ tv.tv_sec = delay / 1000;
+ tv.tv_usec = (delay % 1000) * 1000L;
+
+ if (event_initialized(&c->identify_timer))
+ evtimer_del(&c->identify_timer);
+ evtimer_set(&c->identify_timer, server_client_callback_identify, c);
+ evtimer_add(&c->identify_timer, &tv);
+
+ c->flags |= CLIENT_IDENTIFY;
+ c->tty.flags |= (TTY_FREEZE|TTY_NOCURSOR);
+ server_redraw_client(c);
+}
+
+/* Clear identify mode on client. */
+void
+server_client_clear_identify(struct client *c, struct window_pane *wp)
+{
+ if (~c->flags & CLIENT_IDENTIFY)
+ return;
+ c->flags &= ~CLIENT_IDENTIFY;
+
+ if (c->identify_callback != NULL)
+ c->identify_callback(c, wp);
+
+ c->tty.flags &= ~(TTY_FREEZE|TTY_NOCURSOR);
+ server_redraw_client(c);
+}
+
/* Check if this client is inside this server. */
int
server_client_check_nested(struct client *c)
@@ -190,7 +233,7 @@ server_client_lost(struct client *c)
c->flags |= CLIENT_DEAD;
- server_clear_identify(c, NULL);
+ server_client_clear_identify(c, NULL);
status_prompt_clear(c);
status_message_clear(c);
@@ -758,14 +801,14 @@ server_client_handle_key(struct client *c, key_code key)
wp = window_pane_at_index(w, key - '0');
if (wp != NULL && !window_pane_visible(wp))
wp = NULL;
- server_clear_identify(c, wp);
+ server_client_clear_identify(c, wp);
return;
}
/* Handle status line. */
if (!(c->flags & CLIENT_READONLY)) {
status_message_clear(c);
- server_clear_identify(c, NULL);
+ server_client_clear_identify(c, NULL);
}
if (c->prompt_string != NULL) {
if (c->flags & CLIENT_READONLY)