Add a windowonly generic command and use it where appropriate. Also trim includes and unused.

This commit is contained in:
Nicholas Marriott
2008-06-02 22:09:49 +00:00
parent 95cc21c251
commit 8731755ab4
18 changed files with 187 additions and 296 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-copy-mode.c,v 1.6 2008-06-02 21:36:51 nicm Exp $ */
/* $Id: cmd-copy-mode.c,v 1.7 2008-06-02 22:09:49 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -18,9 +18,6 @@
#include <sys/types.h>
#include <getopt.h>
#include <stdlib.h>
#include "tmux.h"
/*
@ -31,24 +28,24 @@ void cmd_copy_mode_exec(void *, struct cmd_ctx *);
const struct cmd_entry cmd_copy_mode_entry = {
"copy-mode", NULL,
CMD_SESSIONONLY_USAGE,
CMD_WINDOWONLY_USAGE,
0,
cmd_sessiononly_parse,
cmd_windowonly_parse,
cmd_copy_mode_exec,
cmd_sessiononly_send,
cmd_sessiononly_recv,
cmd_sessiononly_free
cmd_windowonly_send,
cmd_windowonly_recv,
cmd_windowonly_free
};
void
cmd_copy_mode_exec(unused void *ptr, struct cmd_ctx *ctx)
cmd_copy_mode_exec(void *ptr, struct cmd_ctx *ctx)
{
struct session *s;
struct winlink *wl;
if ((s = cmd_sessiononly_get(ptr, ctx)) == NULL)
if ((wl = cmd_windowonly_get(ptr, ctx, NULL)) == NULL)
return;
window_set_mode(s->curw->window, &window_copy_mode);
window_set_mode(wl->window, &window_copy_mode);
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);