diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-15 15:44:36 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-15 15:44:36 +0000 |
commit | b0e7bb8bc6243d327f593bce0615d2c556f56e9f (patch) | |
tree | 2f683f142e8ba0c4816ee7dd381ca4c221ec3d57 /terms.c | |
parent | fix indent (diff) | |
download | w3m-b0e7bb8bc6243d327f593bce0615d2c556f56e9f.tar.gz w3m-b0e7bb8bc6243d327f593bce0615d2c556f56e9f.zip |
[w3m-dev 03434] Re: cygwin console on Win9X
* terms.c (cygwin_mouse_btn_swapped): ifdef USE_MOUSE
(lastConMouse): deleted
(check_win9x): static
(read_win32_console): static
(GetConsoleHwnd): static
(cygwin_version): ifdef USE_MOUSE, static
(check_cygwin_console): static
(NEED_XTERM_ON): added
(NEED_XTERM_OFF): added
(NEED_CYGWIN_ON): added
(NEED_CYGWIN_OFF): added
(XTERM_TITLE): static char[]
(SCREEN_TITLE): static char[]
(CYGWIN_TITLE): static char[]
(term_title): check title_str
* terms.h (LASTLINE): added
(is_xterm): deleted
(enable_win9x_console_input): extern
(disable_win9x_console_input): extern
(NEED_XTERM_ON): deleted
(NEED_XTERM_OFF): deleted
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to 'terms.c')
-rw-r--r-- | terms.c | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -1,4 +1,4 @@ -/* $Id: terms.c,v 1.36 2002/11/15 15:37:33 ukai Exp $ */ +/* $Id: terms.c,v 1.37 2002/11/15 15:44:36 ukai Exp $ */ /* * An original curses library for EUC-kanji by Akinori ITO, December 1989 * revised by Akinori ITO, January 1995 @@ -61,18 +61,17 @@ extern int CodePage; #include <sys/cygwin.h> static int isWinConsole = 0; static int isLocalConsole = 0; +#ifdef USE_MOUSE int cygwin_mouse_btn_swapped = 0; +#endif #if defined(SUPPORT_WIN9X_CONSOLE_MBCS) static HANDLE hConIn = INVALID_HANDLE_VALUE; -static int isWin95; +static int isWin95 = 0; static char *ConInV; static int iConIn, nConIn, nConInMax; -#ifdef USE_MOUSE -static MOUSE_EVENT_RECORD lastConMouse; -#endif -void +static void check_win9x(void) { OSVERSIONINFO winVersionInfo; @@ -155,7 +154,7 @@ read_win32_console_input(void) return 0; } -int +static int read_win32_console(char *s, int n) { KEY_EVENT_RECORD *ker; @@ -187,7 +186,7 @@ read_win32_console(char *s, int n) #endif /* SUPPORT_WIN9X_CONSOLE_MBCS */ -HWND +static HWND GetConsoleHwnd(void) { #define MY_BUFSIZE 1024 @@ -205,7 +204,8 @@ GetConsoleHwnd(void) return (hwndFound); } -unsigned long +#ifdef USE_MOUSE +static unsigned long cygwin_version(void) { struct per_process *p; @@ -216,8 +216,9 @@ cygwin_version(void) } return 0; } +#endif -void +static void check_cygwin_console(void) { char *term = getenv("TERM"); @@ -237,10 +238,12 @@ check_cygwin_console(void) check_win9x(); #endif } +#ifdef USE_MOUSE if (cygwin_version() <= 1003015) { /* cygwin DLL 1.3.15 or earler */ cygwin_mouse_btn_swapped = 1; } +#endif } #endif /* __CYGWIN__ */ @@ -414,12 +417,21 @@ writestr(char *s) #ifdef USE_MOUSE #define W3M_TERM_INFO(name, title, mouse) name, title, mouse +#define NEED_XTERM_ON (1) +#define NEED_XTERM_OFF (1<<1) +#ifdef __CYGWIN__ +#define NEED_CYGWIN_ON (1<<2) +#define NEED_CYGWIN_OFF (1<<3) +#endif #else #define W3M_TERM_INFO(name, title, mouse) name, title #endif -#define XTERM_TITLE "\033]0;w3m: %s\007" -#define SCREEN_TITLE "\033k%s\033\134" +static char XTERM_TITLE[] = "\033]0;w3m: %s\007"; +static char SCREEN_TITLE[] = "\033k%s\033\134"; +#ifdef __CYGWIN__ +static char CYGWIN_TITLE[] = "w3m: %s"; +#endif /* *INDENT-OFF* */ static struct w3m_term_info { @@ -436,7 +448,7 @@ static struct w3m_term_info { {W3M_TERM_INFO("mlterm", XTERM_TITLE, (NEED_XTERM_ON|NEED_XTERM_OFF))}, {W3M_TERM_INFO("screen", SCREEN_TITLE, 0)}, #ifdef __CYGWIN__ - {W3M_TERM_INFO("cygwin", XTERM_TITLE, (NEED_CYGWIN_ON|NEED_CYGWIN_OFF))}, + {W3M_TERM_INFO("cygwin", CYGWIN_TITLE, (NEED_CYGWIN_ON|NEED_CYGWIN_OFF))}, #endif {W3M_TERM_INFO(NULL, NULL, 0)} }; @@ -1811,12 +1823,12 @@ term_title(char *s) return; if (title_str != NULL) { #ifdef __CYGWIN__ - if (isLocalConsole) { + if (isLocalConsole && title_str == CYGWIN_TITLE) { char buff[1024]; - snprintf(buff, sizeof(buff), "w3m: %s", s); + snprintf(buff, sizeof(buff), title_str, s); SetConsoleTitle(buff); } - else if (!isWinConsole) + else if (isLocalConsole || !isWinConsole) #endif fprintf(ttyf, title_str, s); } |