[w3m-dev 04092] remove __CYGWIN__ && LANG == JA

WATANABE Katsuyuki <[email protected]>
Newsgroups gmane.comp.web.w3m.devel
Message-ID <[email protected]>
$BEOn5$G$9!#(B

Cygwin $B$N%?!<%_%J%k$^$o$j$G(B LANG == JA $B$G>r7o%3%s%Q%$%k$7$F(B
$B$$$k$H$3$m$,;D$C$F$$$^$7$?$N$G=|5n$7$^$9!#(B
$B$^$?!"%^%&%9%\%?%s$NF~$lBX$($O(B 1.5.x $BL$K~$N$_$H$7$^$7$?!#(B
# 1.5.x $B$G%S%k%I$7$?>l9g$O(B 1.3.x $B$G$OF0:n$7$J$$$N$G!#(B

 * remove condition LANG == JA && __CYGWIN__
 * cygwin_mouse_btn_swapped enabled when before 1.5.x 

diff -urN w3m-0.5.1/config.h.in w3m-0.5.1-cygwinterm/config.h.in
--- w3m-0.5.1/config.h.in	2004-04-05 01:47:20.000000000 +0900
+++ w3m-0.5.1-cygwinterm/config.h.in	2004-07-14 16:18:04.000000000 +0900
@@ -193,10 +193,8 @@
 
 #if defined( __CYGWIN__ )
 #define SUPPORT_NETBIOS_SHARE 1
-#if LANG == JA
 #define SUPPORT_WIN9X_CONSOLE_MBCS 1
 #endif
-#endif
 
 #if defined(__DJGPP__)
 #define DEFAULT_TERM	"dosansi"
diff -urN w3m-0.5.1/display.c w3m-0.5.1-cygwinterm/display.c
--- w3m-0.5.1/display.c	2003-09-27 02:59:52.000000000 +0900
+++ w3m-0.5.1-cygwinterm/display.c	2004-07-14 16:18:06.000000000 +0900
@@ -433,11 +433,11 @@
 		scroll(n);
 	    }
 	    else if (n < 0 && n > -buf->LINES) {
-#if defined(__CYGWIN__) && LANG == JA
+#if 0 /* defined(__CYGWIN__) */
 		move(LASTLINE + n + 1, 0);
 		clrtoeolx();
 		refresh();
-#endif				/* defined(__CYGWIN__) && LANG == JA */
+#endif				/* defined(__CYGWIN__) */
 		rscroll(-n);
 	    }
 	    redrawNLine(buf, n);
diff -urN w3m-0.5.1/fm.h w3m-0.5.1-cygwinterm/fm.h
--- w3m-0.5.1/fm.h	2004-04-17 03:47:20.000000000 +0900
+++ w3m-0.5.1-cygwinterm/fm.h	2004-07-14 16:18:06.000000000 +0900
@@ -759,11 +759,11 @@
  */
 
 extern int LINES, COLS;
-#if defined(__CYGWIN__) && LANG == JA
+#if defined(__CYGWIN__)
 extern int LASTLINE;
-#else				/* not defined(__CYGWIN__) || LANG != JA */
+#else				/* not defined(__CYGWIN__) */
 #define LASTLINE (LINES-1)
-#endif				/* not defined(__CYGWIN__) || LANG != JA */
+#endif				/* not defined(__CYGWIN__) */
 
 global int Tabstop init(8);
 global int IndentIncr init(4);
diff -urN w3m-0.5.1/main.c w3m-0.5.1-cygwinterm/main.c
--- w3m-0.5.1/main.c	2004-04-05 01:47:20.000000000 +0900
+++ w3m-0.5.1-cygwinterm/main.c	2004-07-14 17:57:56.000000000 +0900
@@ -5323,7 +5323,7 @@
     int btn, x, y;
 
     btn = (unsigned char)getch() - 32;
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) && CYGWIN_VERSION_DLL_MAJOR < 1005
     if (cygwin_mouse_btn_swapped) {
 	if (btn == MOUSE_BTN2_DOWN)
 	    btn = MOUSE_BTN3_DOWN;
diff -urN w3m-0.5.1/menu.c w3m-0.5.1-cygwinterm/menu.c
--- w3m-0.5.1/menu.c	2004-03-24 01:44:02.000000000 +0900
+++ w3m-0.5.1-cygwinterm/menu.c	2004-07-14 17:58:22.000000000 +0900
@@ -1183,7 +1183,7 @@
     int btn, x, y;
 
     btn = (unsigned char)getch() - 32;
-#if defined(__CYGWIN__)
+#if defined(__CYGWIN__) && CYGWIN_VERSION_DLL_MAJOR < 1005
     if (cygwin_mouse_btn_swapped) {
 	if (btn == MOUSE_BTN2_DOWN)
 	    btn = MOUSE_BTN3_DOWN;
diff -urN w3m-0.5.1/terms.c w3m-0.5.1-cygwinterm/terms.c
--- w3m-0.5.1/terms.c	2003-12-09 01:06:34.000000000 +0900
+++ w3m-0.5.1-cygwinterm/terms.c	2004-07-14 18:17:06.000000000 +0900
@@ -56,8 +56,11 @@
 #include <windows.h>
 #include <sys/cygwin.h>
 static int isWinConsole = 0;
+#define TERM_CYGWIN 1
+#define TERM_CYGWIN_RESERVE_IME 2
 static int isLocalConsole = 0;
-#ifdef USE_MOUSE
+
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
 int cygwin_mouse_btn_swapped = 0;
 #endif
 
@@ -79,9 +82,6 @@
     }
     if (winVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
 	isWin95 = 1;
-	if (ttyslot() != -1) {
-	    isLocalConsole = 0;
-	}
     }
     else {
 	isWin95 = 0;
@@ -200,7 +200,7 @@
     return (hwndFound);
 }
 
-#ifdef USE_MOUSE
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
 static unsigned long
 cygwin_version(void)
 {
@@ -223,7 +223,7 @@
     if (term == NULL)
 	term = DEFAULT_TERM;
     if (term && strncmp(term, "cygwin", 6) == 0) {
-	isWinConsole = 1;
+	isWinConsole = TERM_CYGWIN;
     }
     if (isWinConsole) {
 	hWnd = GetConsoleHwnd();
@@ -232,11 +232,17 @@
 		isLocalConsole = 1;
 	    }
 	}
+	if (strncmp(getenv("LANG"), "ja", 2) == 0) {
+	    isWinConsole = TERM_CYGWIN_RESERVE_IME;
+	}
 #ifdef SUPPORT_WIN9X_CONSOLE_MBCS
 	check_win9x();
+	if (isWin95 && ttyslot() != -1) {
+	    isLocalConsole = 0;
+	}
 #endif
     }
-#ifdef USE_MOUSE
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
     if (cygwin_version() <= 1003015) {
 	/* cygwin DLL 1.3.15 or earler */
 	cygwin_mouse_btn_swapped = 1;
@@ -382,9 +388,10 @@
     *T_ti, *T_te, *T_nd, *T_as, *T_ae, *T_eA, *T_ac, *T_op;
 
 int LINES, COLS;
-#if defined(__CYGWIN__) && LANG == JA
+#if defined(__CYGWIN__)
 int LASTLINE;
-#endif				/* defined(__CYGWIN__) && LANG == JA */
+#endif				/* defined(__CYGWIN__) */
+
 static int max_LINES = 0, max_COLS = 0;
 static int tab_step = 8;
 static int CurLine, CurColumn;
@@ -763,9 +770,9 @@
 	COLS = MAX_COLUMN;
     if (LINES > MAX_LINE)
 	LINES = MAX_LINE;
-#if defined(__CYGWIN__) && LANG == JA
-    LASTLINE = LINES - (isWinConsole ? 2 : 1);
-#endif				/* defined(__CYGWIN__) && LANG == JA */
+#if defined(__CYGWIN__)
+    LASTLINE = LINES - (isWinConsole == TERM_CYGWIN_RESERVE_IME ? 2 : 1);
+#endif				/* defined(__CYGWIN__) */
 }
 
 void
@@ -1285,9 +1292,7 @@
 		 * (COLS-1,LINES-1).
 		 */
 #if !defined(USE_BG_COLOR) || defined(__CYGWIN__)
-#if defined(__CYGWIN__) && LANG == JA
 		if (isWinConsole)
-#endif				/* defined(__CYGWIN__) && LANG == JA */
 		    if (line == LINES - 1 && col == COLS - 1)
 			break;
 #endif				/* !defined(USE_BG_COLOR) || defined(__CYGWIN__) */
diff -urN w3m-0.5.1/terms.h w3m-0.5.1-cygwinterm/terms.h
--- w3m-0.5.1/terms.h	2003-09-23 06:02:22.000000000 +0900
+++ w3m-0.5.1-cygwinterm/terms.h	2004-07-14 17:56:14.000000000 +0900
@@ -3,7 +3,7 @@
 #define TERMS_H
 
 extern int LINES, COLS;
-#if defined(__CYGWIN__) && LANG == JA
+#if defined(__CYGWIN__)
 extern int LASTLINE;
 #endif
 
@@ -21,7 +21,7 @@
 #endif
 
 #ifdef __CYGWIN__
-#ifdef USE_MOUSE
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
 extern int cygwin_mouse_btn_swapped;
 #endif
 #ifdef SUPPORT_WIN9X_CONSOLE_MBCS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.