mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Next/last/previous window, some other tweaks.
This commit is contained in:
parent
7ba01f6843
commit
815815989a
5
Makefile
5
Makefile
@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.14 2007-10-03 23:32:26 nicm Exp $
|
||||
# $Id: Makefile,v 1.15 2007-10-04 00:02:10 nicm Exp $
|
||||
|
||||
.SUFFIXES: .c .o .y .h
|
||||
.PHONY: clean
|
||||
@ -20,7 +20,8 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
|
||||
xmalloc.c xmalloc-debug.c input.c input-keys.c screen.c window.c \
|
||||
session.c local.c log.c client.c client-msg.c client-fn.c key-string.c \
|
||||
key-bindings.c cmd.c cmd-new-session.c cmd-detach-session.c \
|
||||
cmd-list-sessions.c cmd-new-window.c
|
||||
cmd-list-sessions.c cmd-new-window.c cmd-next-window.c \
|
||||
cmd-previous-window.c cmd-last-window.c
|
||||
|
||||
YACC= yacc -d
|
||||
|
||||
|
55
cmd-last-window.c
Normal file
55
cmd-last-window.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* $Id: cmd-last-window.c,v 1.1 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
/*
|
||||
* Move to last window.
|
||||
*/
|
||||
|
||||
void cmd_last_window_exec(void *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_last_window_entry = {
|
||||
CMD_LASTWINDOW, "last-window", "last", 0,
|
||||
NULL,
|
||||
NULL,
|
||||
cmd_last_window_exec,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
cmd_last_window_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct client *c = ctx->client;
|
||||
struct session *s = ctx->session;
|
||||
|
||||
if (session_last(s) == 0)
|
||||
server_redraw_session(s);
|
||||
else
|
||||
ctx->error(ctx, "no last window");
|
||||
|
||||
if (!(ctx->flags & CMD_KEY))
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-list-sessions.c,v 1.1 2007-10-03 21:31:07 nicm Exp $ */
|
||||
/* $Id: cmd-list-sessions.c,v 1.2 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -27,9 +27,7 @@
|
||||
* List all sessions.
|
||||
*/
|
||||
|
||||
int cmd_list_sessions_parse(void **, int, char **, char **);
|
||||
const char *cmd_list_sessions_usage(void);
|
||||
void cmd_list_sessions_exec(void *, struct cmd_ctx *);
|
||||
void cmd_list_sessions_exec(void *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_list_sessions_entry = {
|
||||
CMD_LISTSESSIONS, "list-sessions", "ls", CMD_NOSESSION,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-new-session.c,v 1.2 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: cmd-new-session.c,v 1.3 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -128,7 +128,7 @@ cmd_new_session_exec(void *ptr, struct cmd_ctx *ctx)
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
else {
|
||||
server_write_client(c, MSG_READY, NULL, 0);
|
||||
server_draw_client(c);
|
||||
server_redraw_client(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-new-window.c,v 1.1 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: cmd-new-window.c,v 1.2 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -120,15 +120,15 @@ cmd_new_window_exec(void *ptr, struct cmd_ctx *ctx)
|
||||
ctx->error(ctx, "command failed: %s", cmd);
|
||||
return;
|
||||
}
|
||||
if (!data->flag_detached)
|
||||
if (!data->flag_detached) {
|
||||
session_select(s, i);
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session == s) {
|
||||
if (!data->flag_detached)
|
||||
server_draw_client(c);
|
||||
server_draw_status(c);
|
||||
server_redraw_session(s);
|
||||
} else {
|
||||
/* XXX */
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session == s)
|
||||
server_redraw_status(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
55
cmd-next-window.c
Normal file
55
cmd-next-window.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* $Id: cmd-next-window.c,v 1.1 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
/*
|
||||
* Move to next window.
|
||||
*/
|
||||
|
||||
void cmd_next_window_exec(void *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_next_window_entry = {
|
||||
CMD_NEXTWINDOW, "next-window", "next", 0,
|
||||
NULL,
|
||||
NULL,
|
||||
cmd_next_window_exec,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
cmd_next_window_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct client *c = ctx->client;
|
||||
struct session *s = ctx->session;
|
||||
|
||||
if (session_next(s) == 0)
|
||||
server_redraw_session(s);
|
||||
else
|
||||
ctx->error(ctx, "no next window");
|
||||
|
||||
if (!(ctx->flags & CMD_KEY))
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
}
|
55
cmd-previous-window.c
Normal file
55
cmd-previous-window.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* $Id: cmd-previous-window.c,v 1.1 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
/*
|
||||
* Move to previous window.
|
||||
*/
|
||||
|
||||
void cmd_previous_window_exec(void *, struct cmd_ctx *);
|
||||
|
||||
const struct cmd_entry cmd_previous_window_entry = {
|
||||
CMD_PREVIOUSWINDOW, "previous-window", "prev", 0,
|
||||
NULL,
|
||||
NULL,
|
||||
cmd_previous_window_exec,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
void
|
||||
cmd_previous_window_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct client *c = ctx->client;
|
||||
struct session *s = ctx->session;
|
||||
|
||||
if (session_previous(s) == 0)
|
||||
server_redraw_session(s);
|
||||
else
|
||||
ctx->error(ctx, "no previous window");
|
||||
|
||||
if (!(ctx->flags & CMD_KEY))
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $Id: key-bindings.c,v 1.2 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: key-bindings.c,v 1.3 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -81,17 +82,17 @@ key_bindings_init(void)
|
||||
{ 's', &cmd_list_sessions_entry },
|
||||
{ 'C', &cmd_new_window_entry },
|
||||
{ 'c', &cmd_new_window_entry },
|
||||
/* { 'N', &cmd_next_window },
|
||||
{ 'n', &cmd_next_window },
|
||||
{ 'P', &cmd_previous_window },
|
||||
{ 'p', &cmd_previous_window },
|
||||
{ 'R', &cmd_refresh_client },
|
||||
{ 'r', &cmd_refresh_client },
|
||||
{ 'L', &cmd_last_window },
|
||||
{ 'l', &cmd_last_window },
|
||||
{ 'I', &cmd_windo_info },
|
||||
{ 'i', &cmd_window_info },
|
||||
{ META, &cmd_meta_entry },
|
||||
{ 'N', &cmd_next_window_entry },
|
||||
{ 'n', &cmd_next_window_entry },
|
||||
{ 'P', &cmd_previous_window_entry },
|
||||
{ 'p', &cmd_previous_window_entry },
|
||||
{ 'L', &cmd_last_window_entry },
|
||||
{ 'l', &cmd_last_window_entry },
|
||||
/* { 'R', &cmd_refresh_client_entry },
|
||||
{ 'r', &cmd_refresh_client_entry },
|
||||
{ 'I', &cmd_windo_info_entry },
|
||||
{ 'i', &cmd_window_info_entry },
|
||||
{ META, &cmd_meta_entry_entry },
|
||||
*//* { '0', cmdx_fn_select, 0, NULL },
|
||||
{ '1', cmdx_fn_select, 1, NULL },
|
||||
{ '2', cmdx_fn_select, 2, NULL },
|
||||
@ -141,6 +142,7 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
|
||||
xvasprintf(&msg, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
*msg = toupper((u_char) *msg);
|
||||
server_write_message(ctx->client, msg);
|
||||
xfree(msg);
|
||||
}
|
||||
|
125
server-fn.c
125
server-fn.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server-fn.c,v 1.15 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: server-fn.c,v 1.16 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -74,7 +74,6 @@ server_find_sessid(struct sessid *sid, char **cause)
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* Write command to a client. */
|
||||
void
|
||||
server_write_client(
|
||||
struct client *c, enum hdrtype type, const void *buf, size_t len)
|
||||
@ -91,56 +90,60 @@ server_write_client(
|
||||
buffer_write(c->out, buf, len);
|
||||
}
|
||||
|
||||
/* Write command to a client with two buffers. */
|
||||
void
|
||||
server_write_client2(struct client *c, enum hdrtype type,
|
||||
const void *buf1, size_t len1, const void *buf2, size_t len2)
|
||||
{
|
||||
struct hdr hdr;
|
||||
|
||||
log_debug("writing %d to client %d", type, c->fd);
|
||||
|
||||
hdr.type = type;
|
||||
hdr.size = len1 + len2;
|
||||
|
||||
buffer_write(c->out, &hdr, sizeof hdr);
|
||||
if (buf1 != NULL)
|
||||
buffer_write(c->out, buf1, len1);
|
||||
if (buf2 != NULL)
|
||||
buffer_write(c->out, buf2, len2);
|
||||
}
|
||||
|
||||
/* Write command to all clients attached to a specific window. */
|
||||
void
|
||||
server_write_clients(
|
||||
struct window *w, enum hdrtype type, const void *buf, size_t len)
|
||||
server_write_session(
|
||||
struct session *s, enum hdrtype type, const void *buf, size_t len)
|
||||
{
|
||||
struct client *c;
|
||||
struct hdr hdr;
|
||||
u_int i;
|
||||
|
||||
hdr.type = type;
|
||||
hdr.size = len;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session != NULL) {
|
||||
if (c != NULL && c->session == s)
|
||||
server_write_client(c, type, buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
server_write_window(
|
||||
struct window *w, enum hdrtype type, const void *buf, size_t len)
|
||||
{
|
||||
struct client *c;
|
||||
u_int i;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session->window == w) {
|
||||
if (c->flags & CLIENT_HOLD) /* XXX OUTPUT only */
|
||||
continue;
|
||||
if (c->session->window == w) {
|
||||
log_debug(
|
||||
"writing %d to clients: %d", type, c->fd);
|
||||
buffer_write(c->out, &hdr, sizeof hdr);
|
||||
if (buf != NULL)
|
||||
buffer_write(c->out, buf, len);
|
||||
}
|
||||
server_write_client(c, type, buf, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Draw window on client. */
|
||||
void
|
||||
server_draw_client(struct client *c)
|
||||
server_redraw_status(struct client *c)
|
||||
{
|
||||
struct hdr hdr;
|
||||
size_t size;
|
||||
|
||||
if (status_lines == 0)
|
||||
return;
|
||||
|
||||
buffer_ensure(c->out, sizeof hdr);
|
||||
buffer_add(c->out, sizeof hdr);
|
||||
size = BUFFER_USED(c->out);
|
||||
|
||||
status_write(c);
|
||||
|
||||
size = BUFFER_USED(c->out) - size;
|
||||
hdr.type = MSG_DATA;
|
||||
hdr.size = size;
|
||||
memcpy(BUFFER_IN(c->out) - size - sizeof hdr, &hdr, sizeof hdr);
|
||||
}
|
||||
|
||||
void
|
||||
server_redraw_client(struct client *c)
|
||||
{
|
||||
struct hdr hdr;
|
||||
size_t size;
|
||||
@ -161,47 +164,35 @@ server_draw_client(struct client *c)
|
||||
} else
|
||||
buffer_reverse_add(c->out, sizeof hdr);
|
||||
|
||||
server_draw_status(c);
|
||||
server_redraw_status(c);
|
||||
}
|
||||
|
||||
/* Draw status line. */
|
||||
void
|
||||
server_draw_status(struct client *c)
|
||||
server_redraw_session(struct session *s)
|
||||
{
|
||||
struct hdr hdr;
|
||||
size_t size;
|
||||
struct client *c;
|
||||
u_int i;
|
||||
|
||||
if (status_lines == 0)
|
||||
return;
|
||||
|
||||
buffer_ensure(c->out, sizeof hdr);
|
||||
buffer_add(c->out, sizeof hdr);
|
||||
size = BUFFER_USED(c->out);
|
||||
|
||||
status_write(c);
|
||||
|
||||
size = BUFFER_USED(c->out) - size;
|
||||
hdr.type = MSG_DATA;
|
||||
hdr.size = size;
|
||||
memcpy(BUFFER_IN(c->out) - size - sizeof hdr, &hdr, sizeof hdr);
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session == s)
|
||||
server_redraw_client(c);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send error message command to client. */
|
||||
void
|
||||
server_write_error(struct client *c, const char *fmt, ...)
|
||||
server_redraw_window(struct window *w)
|
||||
{
|
||||
va_list ap;
|
||||
char *msg;
|
||||
struct client *c;
|
||||
u_int i;
|
||||
|
||||
va_start(ap, fmt);
|
||||
xvasprintf(&msg, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
server_write_client(c, MSG_ERROR, msg, strlen(msg));
|
||||
xfree(msg);
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
c = ARRAY_ITEM(&clients, i);
|
||||
if (c != NULL && c->session->window == w)
|
||||
server_redraw_client(c);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write message command to a client. */
|
||||
void
|
||||
server_write_message(struct client *c, const char *fmt, ...)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: server-msg.c,v 1.21 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: server-msg.c,v 1.22 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -123,7 +123,7 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
|
||||
else {
|
||||
ctx.session = server_find_sessid(&data.sid, &cause);
|
||||
if (ctx.session == NULL) {
|
||||
server_write_error(c, "%s", cause);
|
||||
server_msg_fn_command_error(&ctx, "%s", cause);
|
||||
xfree(cause);
|
||||
return (0);
|
||||
}
|
||||
@ -212,7 +212,7 @@ server_msg_fn_keys(struct hdr *hdr, struct client *c)
|
||||
fatalx("bad MSG_KEYS size");
|
||||
|
||||
if (c->flags & CLIENT_HOLD) {
|
||||
server_draw_client(c);
|
||||
server_redraw_client(c);
|
||||
c->flags &= ~CLIENT_HOLD;
|
||||
}
|
||||
|
||||
|
20
server.c
20
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.21 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.22 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -316,14 +316,12 @@ server_handle_window(struct window *w)
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct buffer *b;
|
||||
u_int i, j, p;
|
||||
u_int i, j;
|
||||
|
||||
b = buffer_create(BUFSIZ);
|
||||
window_data(w, b);
|
||||
if (BUFFER_USED(b) != 0) {
|
||||
server_write_clients(
|
||||
w, MSG_DATA, BUFFER_OUT(b), BUFFER_USED(b));
|
||||
}
|
||||
if (BUFFER_USED(b) != 0)
|
||||
server_write_window(w, MSG_DATA, BUFFER_OUT(b), BUFFER_USED(b));
|
||||
buffer_destroy(b);
|
||||
|
||||
if (!(w->flags & WINDOW_BELL))
|
||||
@ -331,19 +329,13 @@ server_handle_window(struct window *w)
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
if (s == NULL)
|
||||
continue;
|
||||
if (window_index(&s->windows, w, &p) != 0)
|
||||
if (s == NULL || !session_has(s, w))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
||||
c = ARRAY_ITEM(&clients, j);
|
||||
if (c == NULL || c->session != s)
|
||||
continue;
|
||||
/*
|
||||
if (s->window != w)
|
||||
server_write_message(c, "Bell in window %u", p);
|
||||
*/
|
||||
server_write_client(c, MSG_DATA, "\007", 1);
|
||||
}
|
||||
}
|
||||
@ -379,7 +371,7 @@ server_lost_window(struct window *w)
|
||||
c->session = NULL;
|
||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||
} else
|
||||
server_draw_client(c);
|
||||
server_redraw_client(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
tmux.h
26
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.39 2007-10-03 23:32:26 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.40 2007-10-04 00:02:10 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -458,9 +458,12 @@ struct client_ctx {
|
||||
/* Key/command line command. */
|
||||
enum cmd_type {
|
||||
CMD_DETACHSESSION,
|
||||
CMD_LASTWINDOW,
|
||||
CMD_LISTSESSIONS,
|
||||
CMD_NEWSESSION,
|
||||
CMD_NEWWINDOW,
|
||||
CMD_NEXTWINDOW,
|
||||
CMD_PREVIOUSWINDOW,
|
||||
};
|
||||
|
||||
struct cmd_ctx {
|
||||
@ -523,9 +526,12 @@ void cmd_free(struct cmd *);
|
||||
void cmd_send_string(struct buffer *, const char *);
|
||||
char *cmd_recv_string(struct buffer *);
|
||||
extern const struct cmd_entry cmd_detach_session_entry;
|
||||
extern const struct cmd_entry cmd_last_window_entry;
|
||||
extern const struct cmd_entry cmd_list_sessions_entry;
|
||||
extern const struct cmd_entry cmd_new_session_entry;
|
||||
extern const struct cmd_entry cmd_new_window_entry;
|
||||
extern const struct cmd_entry cmd_next_window_entry;
|
||||
extern const struct cmd_entry cmd_previous_window_entry;
|
||||
|
||||
/* bind.c */
|
||||
const struct bind *cmdx_lookup_bind(const char *);
|
||||
@ -568,17 +574,17 @@ int server_msg_dispatch(struct client *);
|
||||
|
||||
/* server-fn.c */
|
||||
struct session *server_find_sessid(struct sessid *, char **);
|
||||
void server_write_error(struct client *, const char *, ...);
|
||||
void server_write_message(struct client *, const char *, ...);
|
||||
void server_write_client(
|
||||
struct client *, enum hdrtype, const void *, size_t);
|
||||
void server_write_client2(struct client *,
|
||||
enum hdrtype, const void *, size_t, const void *, size_t);
|
||||
void server_write_clients(
|
||||
struct window *, enum hdrtype, const void *, size_t);
|
||||
void server_window_changed(struct client *);
|
||||
void server_draw_client(struct client *);
|
||||
void server_draw_status(struct client *);
|
||||
void server_write_session(
|
||||
struct session *, enum hdrtype, const void *, size_t);
|
||||
void server_write_window(
|
||||
struct window *, enum hdrtype, const void *, size_t);
|
||||
void server_redraw_status(struct client *);
|
||||
void server_redraw_client(struct client *);
|
||||
void server_redraw_session(struct session *);
|
||||
void server_redraw_window(struct window *);
|
||||
void server_write_message(struct client *, const char *, ...);
|
||||
|
||||
/* status.c */
|
||||
void status_write(struct client *c);
|
||||
|
Loading…
Reference in New Issue
Block a user