summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-03-14 23:02:37 -0400
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-03-14 23:02:37 -0400
commit8a6abbab0161e6df1cea2ae0033a4c7f4a47f8e9 (patch)
treeabc8b7b1047c75884666c3b26bb1e42686d3fdb2
parent6e67aee852c60c8b8a67981233ed29ca48ff8506 (diff)
downloadscreen-8a6abbab0161e6df1cea2ae0033a4c7f4a47f8e9.tar.gz
Add special rendition for silence'd windows.
The default rendition for silence'd windows in caption/hardstatus or in the windowlist is =u (underline). Closes savannah bug #29205.
-rw-r--r--src/ChangeLog2
-rw-r--r--src/ansi.c4
-rw-r--r--src/doc/screen.14
-rw-r--r--src/doc/screen.texinfo8
-rw-r--r--src/image.h1
-rw-r--r--src/list_window.c5
-rw-r--r--src/process.c6
-rw-r--r--src/screen.c9
-rw-r--r--src/screen.h8
-rw-r--r--src/window.c2
-rw-r--r--src/window.h10
11 files changed, 42 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0ac432a..df04dca 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -3,7 +3,7 @@ Version 4.1.0 (??/??/20??):
* 'unbindall' to unbind all commands
* 'up', 'down', 'left', 'right' sub-commands for 'focus'
* 'rendition' to specify rendition to use in caption/hardstatus for
- window-names that have bell/monitor/so turned on.
+ window-names that have bell/monitor/silence/so turned on.
* 'layout', with the following sub-commands
- 'title'
- 'number'
diff --git a/src/ansi.c b/src/ansi.c
index f9e0cc8..b75d14f 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -78,10 +78,10 @@ struct mchar mchar_null;
struct mchar mchar_blank = {' ' /* , 0, 0, ... */};
struct mchar mchar_so = {' ', A_SO /* , 0, 0, ... */};
-int renditions[NUM_RENDS] = {65529 /* =ub */, 65531 /* =b */};
+int renditions[NUM_RENDS] = {65529 /* =ub */, 65531 /* =b */, 65533 /* =u */ };
/* keep string_t and string_t_string in sync! */
-static char *string_t_string[] =
+static char *string_t_string[] =
{
"NONE",
"DCS", /* Device control string */
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index 83deb02..a250b92 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -2717,13 +2717,13 @@ Unlinks the screen-exchange file used by the commands \*Qwritebuf\*U and
\*Qreadbuf\*U.
.sp
.ne 3
-.B "rendition bell" | monitor | so
+.B "rendition bell" | monitor | silence | so
.RB "\fIattr\fR " [ \fIcolor ]
.PP
Change the way
.I screen
renders the titles of windows that have monitor or bell flags set in caption or hardstatus or windowlist. See the \*QSTRING ESCAPES\*U chapter for the syntax of the modifiers.
-The default for monitor is currently \*Q=b \*U (bold, active colors) and for bell \*Q=ub \*U (underline, bold and active colors).
+The default for monitor is currently \*Q=b \*U (bold, active colors), for bell \*Q=ub \*U (underline, bold and active colors), and \*Q=u \*U for silence.
.sp
.ne 3
.B "reset"
diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index d453b07..03dccdf 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -1142,7 +1142,7 @@ Store a string to a register. @xref{Registers}.
Kill current region. @xref{Regions}.
@item removebuf
Delete the screen-exchange file. @xref{Screen Exchange}.
-@item rendition bell | monitor | so @var{attr} [@var{color}]
+@item rendition bell | monitor | silence | so @var{attr} [@var{color}]
Change text attributes in caption for flagged windows. @xref{Rendition}.
@item reset
Reset the terminal settings for the window. @xref{Reset}.
@@ -5069,15 +5069,15 @@ access to your terminal, they will be able to fire off print commands.
@node Rendition, Sorendition, Printcmd, Miscellaneous
@section Rendition
-@deffn Command rendition bell | monitor | so @var{attr} [@var{color}]
+@deffn Command rendition bell | monitor | silence | so @var{attr} [@var{color}]
(none)@*
Change the way screen renders the titles of windows that have monitor
or bell flags set in caption or hardstatus or windowlist.
See the chapter
about string escapes (@pxref{String Escapes}) for the syntax of
the modifiers. The default for monitor is currently @samp{=b} (bold,
-active colors), and for bell is @samp{=ub} (underline, bold and
-active colors).
+active colors), for bell @samp{=ub} (underline, bold and active colors), and
+for silence @samp{=u}.
@end deffn
@node Sorendition, Attrcolor, Rendition, Miscellaneous
diff --git a/src/image.h b/src/image.h
index 8622534..c105949 100644
--- a/src/image.h
+++ b/src/image.h
@@ -171,6 +171,7 @@ enum
{
REND_BELL = 0,
REND_MONITOR,
+ REND_SILENCE,
NUM_RENDS
};
diff --git a/src/list_window.c b/src/list_window.c
index ee71fde..b65600d 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -266,6 +266,11 @@ gl_Window_row(struct ListData *ldata, struct ListRow *lrow)
mchar = &mchar_rend;
ApplyAttrColor(renditions[REND_BELL], mchar);
}
+ else if ((w->w_silence == SILENCE_FOUND || w->w_silence == SILENCE_DONE) && renditions[REND_SILENCE] != -1)
+ {
+ mchar = &mchar_rend;
+ ApplyAttrColor(renditions[REND_SILENCE], mchar);
+ }
else
mchar = &mchar_blank;
diff --git a/src/process.c b/src/process.c
index d685501..cb90802 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3894,6 +3894,10 @@ int key;
{
i = REND_MONITOR;
}
+ else if (strcmp(args[0], "silence") == 0)
+ {
+ i = REND_SILENCE;
+ }
else if (strcmp(args[0], "so") != 0)
{
Msg(0, "Invalid option '%s' for rendition", args[0]);
@@ -5357,6 +5361,8 @@ int where;
rend = renditions[REND_MONITOR];
else if ((p->w_bell == BELL_DONE || p->w_bell == BELL_FOUND) && renditions[REND_BELL] != -1)
rend = renditions[REND_BELL];
+ else if ((p->w_silence == SILENCE_FOUND || p->w_silence == SILENCE_DONE) && renditions[REND_SILENCE] != -1)
+ rend = renditions[REND_SILENCE];
}
if (rend != -1)
AddWinMsgRend(s, rend);
diff --git a/src/screen.c b/src/screen.c
index 2a905a8..5c15a39 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3241,6 +3241,15 @@ char *data;
}
WindowChanged(p, 'f');
}
+ if (p->w_silence == SILENCE_FOUND)
+ {
+ /* Unset the flag if the user switched to this window. */
+ if (p->w_layer.l_cvlist)
+ {
+ p->w_silence = SILENCE_ON;
+ WindowChanged(p, 'f');
+ }
+ }
}
for (display = displays; display; display = display->d_next)
diff --git a/src/screen.h b/src/screen.h
index a24c021..5c93f32 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -256,7 +256,7 @@ struct msg
#define VBELLWAIT 1 /* No. of seconds a vbell will be displayed */
#define BELL_ON 0 /* No bell has occurred in the window */
-#define BELL_FOUND 1 /* A bell has occurred, but user not yet notified */
+#define BELL_FOUND 1 /* A bell has occurred, but user not yet notified */
#define BELL_DONE 2 /* A bell has occured, user has been notified */
#define BELL_VISUAL 3 /* A bell has occured in fore win, notify him visually */
@@ -271,8 +271,10 @@ struct msg
#define DUMP_EXCHANGE 2
#define DUMP_SCROLLBACK 3
-#define SILENCE_OFF 0
-#define SILENCE_ON 1
+#define SILENCE_OFF 0 /* Not checking for silence */
+#define SILENCE_ON 1 /* Window being monitored for silence */
+#define SILENCE_FOUND 2 /* Window is silent */
+#define SILENCE_DONE 3 /* Window is silent and user is notified */
extern char strnomem[];
diff --git a/src/window.c b/src/window.c
index a800d4a..1716796 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2069,6 +2069,8 @@ char *data;
continue;
#endif
Msg(0, "Window %d: silence for %d seconds", p->w_number, p->w_silencewait);
+ p->w_silence = SILENCE_FOUND;
+ WindowChanged(p, 'f');
}
}
diff --git a/src/window.h b/src/window.h
index 6bd8e2d..47f5c9e 100644
--- a/src/window.h
+++ b/src/window.h
@@ -133,7 +133,7 @@ struct paster
struct paster;
#endif
-struct win
+struct win
{
struct win *w_next; /* next window */
int w_type; /* type of window */
@@ -187,7 +187,7 @@ struct win
int w_CharsetR; /* charset number GR */
int w_charsets[4]; /* Font = charsets[Charset] */
#endif
- int w_ss;
+ int w_ss;
int w_saved;
int w_Saved_x, w_Saved_y;
struct mchar w_SavedRend;
@@ -227,7 +227,7 @@ struct win
int w_monitor; /* monitor status */
int w_silencewait; /* wait for silencewait secs */
int w_silence; /* silence status (Lloyd Zusman) */
- char w_vbwait;
+ char w_vbwait;
char w_norefresh; /* dont redisplay when switching to that win */
#ifdef RXVT_OSC
char w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */
@@ -246,8 +246,8 @@ struct win
#else
int w_histheight; /* always 0 */
#endif
- int w_pid; /* process at the other end of ptyfd */
- int w_deadpid; /* saved w_pid of a process that closed the ptyfd to us */
+ int w_pid; /* process at the other end of ptyfd */
+ int w_deadpid; /* saved w_pid of a process that closed the ptyfd to us */
char *w_cmdargs[MAXARGS]; /* command line argument vector */
char *w_dir; /* directory for chdir */