w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit fce35fe2bfafc9ee3514a008ea823306dc9fe5c7
parent 7901bbe1f1fc1c9425b3190b06b3f1ac56e6dc0c
Author: ukai <ukai>
Date:   Fri, 15 Nov 2002 15:44:36 +0000

[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:
MChangeLog | 25+++++++++++++++++++++++++
Mterms.c | 42+++++++++++++++++++++++++++---------------
Mterms.h | 16++++++++--------
3 files changed, 60 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,28 @@ +2002-11-16 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + + * [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 + 2002-11-16 WATANABE Katsuyuki <katsuyuki_1.watanabe@toppan.co.jp> * [w3m-dev 03433] cygwin console on Win9X diff --git a/terms.c b/terms.c @@ -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); } diff --git a/terms.h b/terms.h @@ -3,6 +3,9 @@ #define TERMS_H extern int LINES, COLS; +#if defined(__CYGWIN__) && LANG == JA +extern int LASTLINE; +#endif #define CODE_ASCII '\0' #define CODE_EUC 'E' @@ -37,19 +40,16 @@ extern int LINES, COLS; #define MOUSE_BTN5_DOWN_XTERM 65 #define MOUSE_BTN_UP 3 #define MOUSE_BTN_RESET -1 +#endif #ifdef __CYGWIN__ -extern int is_xterm; +#ifdef USE_MOUSE extern int cygwin_mouse_btn_swapped; -#ifdef SUPPORT_WIN9X_CONSOLE_MBCS -void enable_win9x_console_input(void); -void disable_win9x_console_input(void); #endif -#define NEED_CYGWIN_ON (1<<2) -#define NEED_CYGWIN_OFF (1<<3) +#ifdef SUPPORT_WIN9X_CONSOLE_MBCS +extern void enable_win9x_console_input(void); +extern void disable_win9x_console_input(void); #endif -#define NEED_XTERM_ON (1) -#define NEED_XTERM_OFF (1<<1) #endif #endif /* not TERMS_H */