diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-03-15 18:33:31 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-03-15 18:33:31 +0000 |
commit | d2f5a95a9b6212c7f6ba462131b9d3e6aec94db5 (patch) | |
tree | be32bbac734f3ab34bb1f0dd46f83ba1dc9426cc | |
parent | [w3m-dev 03132] Re: Reload image (diff) | |
download | w3m-d2f5a95a9b6212c7f6ba462131b9d3e6aec94db5.tar.gz w3m-d2f5a95a9b6212c7f6ba462131b9d3e6aec94db5.zip |
-title support
modified [w3m-dev-en 00710] contrib: unofficial "xterm title" patch, updated for w3m-0.3
by Moritz Barsnick <barsnick@gmx.net>
* NEWS: -title
* fm.h (displayTitleTerm): added
* proto.h (term_title): added
* main.c (fusage): add -title
(MAIN): add -title
(quitfm): term_title("")
* display.c (displayBuffer): term_title()
* terms.c (title_str): added
(TERM_INFO): added
(term_info): modified from mouse_term_info
(term_info_list): modified from xterm_mouse_term
add "screen"
(set_tty): check displayTitleTerm
(term_title): added
From: Fumitoshi UKAI <ukai@debian.or.jp>
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | display.c | 3 | ||||
-rw-r--r-- | fm.h | 3 | ||||
-rw-r--r-- | main.c | 8 | ||||
-rw-r--r-- | proto.h | 3 | ||||
-rw-r--r-- | terms.c | 64 |
7 files changed, 83 insertions, 21 deletions
@@ -1,3 +1,23 @@ +2002-03-16 Fumitoshi UKAI <ukai@debian.or.jp> + + * -title support + modified [w3m-dev-en 00710] contrib: unofficial "xterm title" patch, updated for w3m-0.3 + by Moritz Barsnick <barsnick@gmx.net> + * NEWS: -title + * fm.h (displayTitleTerm): added + * proto.h (term_title): added + * main.c (fusage): add -title + (MAIN): add -title + (quitfm): term_title("") + * display.c (displayBuffer): term_title() + * terms.c (title_str): added + (TERM_INFO): added + (term_info): modified from mouse_term_info + (term_info_list): modified from xterm_mouse_term + add "screen" + (set_tty): check displayTitleTerm + (term_title): added + 2002-03-16 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> * [w3m-dev 03132] Re: Reload image @@ -3207,4 +3227,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.353 2002/03/15 16:35:46 ukai Exp $ +$Id: ChangeLog,v 1.354 2002/03/15 18:33:31 ukai Exp $ @@ -1,5 +1,6 @@ w3m 0.4? +* -title option: set buffer name to terminal title * X-Face support: USE_XFACE, require uncompface ---------------------------------------------------------------- @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.21 2002/03/10 15:55:15 ukai Exp $ */ +/* $Id: display.c,v 1.22 2002/03/15 18:33:32 ukai Exp $ */ #include <signal.h> #include "fm.h" @@ -383,6 +383,7 @@ displayBuffer(Buffer *buf, int mode) standout(); message(msg->ptr, buf->cursorX + buf->rootX, buf->cursorY); standend(); + term_title(buf->buffername); refresh(); #ifdef USE_IMAGE if (activeImage && displayImage && buf->img) { @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.55 2002/03/14 16:12:07 ukai Exp $ */ +/* $Id: fm.h,v 1.56 2002/03/15 18:33:32 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -816,6 +816,7 @@ global int label_topline init(FALSE); #ifdef NEXTPAGE_TOPLINE global int nextpage_topline init(FALSE); #endif +global char *displayTitleTerm init(NULL); global int displayLink init(FALSE); global int retryAsHttp init(TRUE); global int showLineNum init(FALSE); @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.88 2002/03/15 16:35:46 ukai Exp $ */ +/* $Id: main.c,v 1.89 2002/03/15 18:33:32 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -230,6 +230,7 @@ fusage(FILE * f, int err) #endif fprintf(f, " -W toggle wrap search mode\n"); fprintf(f, " -X don't use termcap init/deinit\n"); + fprintf(f, " -title[=TERM] set buffer name to terminal title string\n"); fprintf(f, " -o opt=value assign value to config option\n"); fprintf(f, " -config file specify config file\n"); fprintf(f, " -help print this usage message\n"); @@ -659,6 +660,10 @@ MAIN(int argc, char **argv, char **envp) squeezeBlankLine = TRUE; else if (!strcmp("-X", argv[i])) Do_not_use_ti_te = TRUE; + else if (!strcmp("-title", argv[i])) + displayTitleTerm = getenv("TERM"); + else if (!strncmp("-title=", argv[i], 7)) + displayTitleTerm = argv[i]+7; else if (!strcmp("-o", argv[i])) { if (++i >= argc || !strcmp(argv[i], "?")) { show_params_p = 1; @@ -2168,6 +2173,7 @@ qquitfm(void) void quitfm(void) { + term_title(""); /* XXX */ #ifdef USE_IMAGE if (activeImage) termImage(); @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.38 2002/03/14 15:41:54 ukai Exp $ */ +/* $Id: proto.h,v 1.39 2002/03/15 18:33:32 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -416,6 +416,7 @@ extern void term_noecho(void); extern void term_raw(void); extern void term_cooked(void); extern void term_cbreak(void); +extern void term_title(char *s); extern void flush_tty(void); extern void toggle_stand(void); extern char getch(void); @@ -1,4 +1,4 @@ -/* $Id: terms.c,v 1.28 2002/01/31 17:54:56 ukai Exp $ */ +/* $Id: terms.c,v 1.29 2002/03/15 18:33:32 ukai Exp $ */ /* * An original curses library for EUC-kanji by Akinori ITO, December 1989 * revised by Akinori ITO, January 1995 @@ -42,6 +42,8 @@ void mouse_init(), mouse_end(); int mouseActive = 0; #endif /* USE_MOUSE */ +static char *title_str = NULL; + static int tty; #include "terms.h" @@ -474,22 +476,34 @@ writestr(char *s) #define MOVE(line,column) writestr(tgoto(T_cm,column,line)); #ifdef USE_MOUSE -static struct mouse_term_info { +#define TERM_INFO(name, title, mouse) name, title, mouse +#else +#define TERM_INFO(name, title, mouse) name, title +#endif + +#define XTERM_TITLE "\033]0;w3m: %s\007" +#define SCREEN_TITLE "\033k%s\033\134" + +static struct term_info { char *term; - int flag; -} xterm_mouse_term[] = { - { - "xterm", NEED_XTERM_ON | NEED_XTERM_OFF}, { - "kterm", NEED_XTERM_ON | NEED_XTERM_OFF}, { - "rxvt", NEED_XTERM_ON | NEED_XTERM_OFF}, + char *title_str; +#ifdef USE_MOUSE + int mouse_flag; +#endif +} term_info_list[] = { + /* *INDENT-OFF* */ + {TERM_INFO("xterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))}, + {TERM_INFO("kterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))}, + {TERM_INFO("rxvt", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))}, + {TERM_INFO("Eterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))}, + {TERM_INFO("screen", SCREEN_TITLE, 0)}, #ifdef __CYGWIN__ - { - "cygwin", NEED_XTERM_ON}, + {TERM_INFO("cygwin", NULL, NEED_XTERM_ON)}, #endif - { - NULL, 0} + {TERM_INFO(NULL, NULL, 0)} + /* *INDENT-ON * */ }; -#endif +#undef TERM_INFO int set_tty(void) @@ -510,13 +524,22 @@ set_tty(void) init_win32_console_handle(); #endif TerminalGet(tty, &d_ioval); + if (displayTitleTerm != NULL) { + struct term_info *p; + for (p = term_info_list; p->term != NULL; p++) { + if (!strncmp(displayTitleTerm, p->term, strlen(p->term))) { + title_str = p->title_str; + break; + } + } + } #ifdef USE_MOUSE { char *term = getenv("TERM"); - struct mouse_term_info *p; - for (p = xterm_mouse_term; p->term != NULL; p++) { + struct term_info *p; + for (p = term_info_list; p->term != NULL; p++) { if (!strncmp(term, p->term, strlen(p->term))) { - is_xterm = p->flag; + is_xterm = p->mouse_flag; break; } } @@ -1837,6 +1860,15 @@ term_cbreak(void) term_noecho(); } +void +term_title(char *s) +{ + if (!fmInitialized) + return; + if (title_str != NULL) + fprintf(stderr, title_str, s); +} + char getch(void) { |