diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-30 13:02:14 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-30 13:02:14 +0000 |
commit | 308bc18947506adebc0c469528b926e31c9b52b8 (patch) | |
tree | b7c5a683b61f1443840b5f47fb710841e9cdf5ed /server-msg.c | |
parent | f4fd8c225e3be626875fab6c746b68d64060abcc (diff) |
Window info command.
Diffstat (limited to 'server-msg.c')
-rw-r--r-- | server-msg.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/server-msg.c b/server-msg.c index 08c5918a..422896ad 100644 --- a/server-msg.c +++ b/server-msg.c @@ -1,4 +1,4 @@ -/* $Id: server-msg.c,v 1.11 2007-09-29 19:53:39 nicm Exp $ */ +/* $Id: server-msg.c,v 1.12 2007-09-30 13:02:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -37,6 +37,7 @@ int server_msg_fn_select(struct hdr *, struct client *); int server_msg_fn_sessions(struct hdr *, struct client *); int server_msg_fn_size(struct hdr *, struct client *); int server_msg_fn_windowlist(struct hdr *, struct client *); +int server_msg_fn_windowinfo(struct hdr *, struct client *); int server_msg_fn_windows(struct hdr *, struct client *); struct server_msg { @@ -58,6 +59,7 @@ struct server_msg server_msg_table[] = { { MSG_SESSIONS, server_msg_fn_sessions }, { MSG_SIZE, server_msg_fn_size }, { MSG_WINDOWLIST, server_msg_fn_windowlist }, + { MSG_WINDOWINFO, server_msg_fn_windowinfo }, { MSG_WINDOWS, server_msg_fn_windows }, }; #define NSERVERMSG (sizeof server_msg_table / sizeof server_msg_table[0]) @@ -472,3 +474,33 @@ server_msg_fn_windowlist(struct hdr *hdr, struct client *c) return (0); } + +/* Window info message from client */ +int +server_msg_fn_windowinfo(struct hdr *hdr, struct client *c) +{ + struct window *w; + char *buf; + size_t len; + u_int i; + + if (c->session == NULL) + return (0); + if (hdr->size != 0) + fatalx("bad MSG_WINDOWINFO size"); + + len = c->sx + 1; + buf = xmalloc(len); + + w = c->session->window; + window_index(&c->session->windows, w, &i); + xsnprintf(buf, len, "%u:%s \"%s\" (size %u,%u) (cursor %u,%u) " + "(region %u,%u)", i, w->name, w->screen.title, w->screen.sx, + w->screen.sy, w->screen.cx, w->screen.cy, w->screen.ry_upper, + w->screen.ry_lower); + + server_write_message(c, "%s", buf); + xfree(buf); + + return (0); +} |