mirror of
https://github.com/tmux/tmux.git
synced 2025-01-08 08:58:47 +00:00
Window flags, currently only bell.
This commit is contained in:
parent
feff317fbd
commit
0bbe838b25
20
input.c
20
input.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: input.c,v 1.7 2007-09-28 22:54:21 nicm Exp $ */
|
/* $Id: input.c,v 1.8 2007-09-29 09:15:49 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -146,7 +146,17 @@ input_free(struct input_ctx *ictx)
|
|||||||
ARRAY_FREE(&ictx->args);
|
ARRAY_FREE(&ictx->args);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
void
|
||||||
|
input_parse1(struct screen *s, u_char *buf, size_t len, struct buffer *b)
|
||||||
|
{
|
||||||
|
struct input_ctx ictx;
|
||||||
|
|
||||||
|
input_init(&ictx, s);
|
||||||
|
input_parse(&ictx, buf, len, b);
|
||||||
|
input_free(&ictx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
input_parse(struct input_ctx *ictx, u_char *buf, size_t len, struct buffer *b)
|
input_parse(struct input_ctx *ictx, u_char *buf, size_t len, struct buffer *b)
|
||||||
{
|
{
|
||||||
enum input_class iclass;
|
enum input_class iclass;
|
||||||
@ -157,6 +167,7 @@ input_parse(struct input_ctx *ictx, u_char *buf, size_t len, struct buffer *b)
|
|||||||
ictx->off = 0;
|
ictx->off = 0;
|
||||||
|
|
||||||
ictx->b = b;
|
ictx->b = b;
|
||||||
|
ictx->flags = 0;
|
||||||
|
|
||||||
log_debug2("entry; buffer=%zu", ictx->len);
|
log_debug2("entry; buffer=%zu", ictx->len);
|
||||||
|
|
||||||
@ -165,8 +176,6 @@ input_parse(struct input_ctx *ictx, u_char *buf, size_t len, struct buffer *b)
|
|||||||
iclass = input_lookup_class(ch);
|
iclass = input_lookup_class(ch);
|
||||||
ictx->state = ictx->state(ch, iclass, ictx);
|
ictx->state = ictx->state(ch, iclass, ictx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ictx->len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
@ -394,6 +403,9 @@ input_handle_c0_control(u_char ch, struct input_ctx *ictx)
|
|||||||
case '\r': /* CR */
|
case '\r': /* CR */
|
||||||
ictx->s->cx = 0;
|
ictx->s->cx = 0;
|
||||||
break;
|
break;
|
||||||
|
case '\007': /* BELL */
|
||||||
|
ictx->flags |= INPUT_BELL;
|
||||||
|
break;
|
||||||
case '\010': /* BS */
|
case '\010': /* BS */
|
||||||
if (ictx->s->cx > 0)
|
if (ictx->s->cx > 0)
|
||||||
ictx->s->cx--;
|
ictx->s->cx--;
|
||||||
|
14
tmux.h
14
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.21 2007-09-28 22:47:21 nicm Exp $ */
|
/* $Id: tmux.h,v 1.22 2007-09-29 09:15:49 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -422,6 +422,9 @@ struct input_ctx {
|
|||||||
size_t len;
|
size_t len;
|
||||||
size_t off;
|
size_t off;
|
||||||
|
|
||||||
|
int flags;
|
||||||
|
#define INPUT_BELL 0x1
|
||||||
|
|
||||||
struct buffer *b;
|
struct buffer *b;
|
||||||
struct screen *s;
|
struct screen *s;
|
||||||
|
|
||||||
@ -435,6 +438,9 @@ struct input_ctx {
|
|||||||
ARRAY_DECL(, struct input_arg) args;
|
ARRAY_DECL(, struct input_arg) args;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Input context macros. */
|
||||||
|
#define INPUT_FLAGS(ictx) ((ictx)->flags)
|
||||||
|
|
||||||
/* Window structure. */
|
/* Window structure. */
|
||||||
struct window {
|
struct window {
|
||||||
char name[MAXNAMELEN];
|
char name[MAXNAMELEN];
|
||||||
@ -447,6 +453,9 @@ struct window {
|
|||||||
|
|
||||||
struct input_ctx ictx;
|
struct input_ctx ictx;
|
||||||
|
|
||||||
|
int flags;
|
||||||
|
#define WINDOW_BELL 0x1
|
||||||
|
|
||||||
struct screen screen;
|
struct screen screen;
|
||||||
};
|
};
|
||||||
ARRAY_DECL(windows, struct window *);
|
ARRAY_DECL(windows, struct window *);
|
||||||
@ -540,7 +549,8 @@ void server_draw_client(struct client *, u_int, u_int);
|
|||||||
/* input.c */
|
/* input.c */
|
||||||
void input_init(struct input_ctx *, struct screen *);
|
void input_init(struct input_ctx *, struct screen *);
|
||||||
void input_free(struct input_ctx *);
|
void input_free(struct input_ctx *);
|
||||||
size_t input_parse(struct input_ctx *, u_char *, size_t, struct buffer *);
|
void input_parse1(struct screen *, u_char *, size_t, struct buffer *);
|
||||||
|
void input_parse(struct input_ctx *, u_char *, size_t, struct buffer *);
|
||||||
uint8_t input_extract8(struct buffer *);
|
uint8_t input_extract8(struct buffer *);
|
||||||
uint16_t input_extract16(struct buffer *);
|
uint16_t input_extract16(struct buffer *);
|
||||||
void input_store8(struct buffer *, uint8_t);
|
void input_store8(struct buffer *, uint8_t);
|
||||||
|
13
window.c
13
window.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window.c,v 1.12 2007-09-28 22:47:22 nicm Exp $ */
|
/* $Id: window.c,v 1.13 2007-09-29 09:15:49 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -314,9 +314,12 @@ window_input(struct window *w, struct buffer *b, size_t size)
|
|||||||
void
|
void
|
||||||
window_output(struct window *w, struct buffer *b)
|
window_output(struct window *w, struct buffer *b)
|
||||||
{
|
{
|
||||||
size_t used;
|
if (BUFFER_USED(w->in) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
used = input_parse(&w->ictx, BUFFER_OUT(w->in), BUFFER_USED(w->in), b);
|
input_parse(&w->ictx, BUFFER_OUT(w->in), BUFFER_USED(w->in), b);
|
||||||
if (used != 0)
|
buffer_remove(w->in, BUFFER_USED(w->in));
|
||||||
buffer_remove(w->in, used);
|
|
||||||
|
if (INPUT_FLAGS(&w->ictx) & INPUT_BELL)
|
||||||
|
w->flags |= WINDOW_BELL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user