commit 3d26e0a2d803e86d6515e7f57a3e07e57293c600
parent da95fde812a6ad6038a391c0f5834600f1786839
Author: ukai <ukai>
Date: Mon, 11 Nov 2002 15:33:28 +0000
[w3m-dev 03408] fix Bug#87472: MOUSE_SCROLL_LINE should be a run-time option
* fm.h (relative_wheel_scroll): added
(fixed_wheel_scroll_count): added
(relative_wheel_scroll_ratio): added
* main.c (mouse_scroll_line): added
(process_mouse): s/MOUSE_SCROLL_LINE/mouse_scroll_line()/
* menu.c (MOUSE_SCROLL_LINE): deleted
* terms.h (MOUSE_SCROLL_LINE): deleted
* rc.c (CMT_RELATIVE_WHEEL_SCROLL): added
(CMT_RELATIVE_WHEEL_SCROLL_RATIO): added
(CMT_FIXED_WHEEL_SCROLL_COUNT): added
(wheelmode): added
(params3): add relative_wheel_scroll,
relative_wheel_scroll_ratio,
fixed_wheel_scroll_count
From: AIDA Shinra <aida-s@jcom.home.ne.jp>
Diffstat:
7 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,23 @@
+2002-11-12 AIDA Shinra <aida-s@jcom.home.ne.jp>
+
+ * [w3m-dev 03408] fix Bug#87472
+ MOUSE_SCROLL_LINE should be a run-time option
+ * fm.h (relative_wheel_scroll): added
+ (fixed_wheel_scroll_count): added
+ (relative_wheel_scroll_ratio): added
+ * main.c (mouse_scroll_line): added
+ (process_mouse): s/MOUSE_SCROLL_LINE/mouse_scroll_line()/
+ * menu.c (MOUSE_SCROLL_LINE): deleted
+ * terms.h (MOUSE_SCROLL_LINE): deleted
+ * rc.c (CMT_RELATIVE_WHEEL_SCROLL): added
+ (CMT_RELATIVE_WHEEL_SCROLL_RATIO): added
+ (CMT_FIXED_WHEEL_SCROLL_COUNT): added
+ (wheelmode): added
+ (params3): add relative_wheel_scroll,
+ relative_wheel_scroll_ratio,
+ fixed_wheel_scroll_count
+ * NEWS: updated
+
2002-11-12 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03407] char GlobalKeymap -> unsigned char GlobalKeymap
diff --git a/NEWS b/NEWS
@@ -1,5 +1,8 @@
w3m 0.3.3 or 0.4?
+* rc: relative_wheel_scroll
+* rc: relative_wheel_scroll_ratio
+* rc: fixed_wheel_scroll_count
* separate auxbindir and libdir (local-CGI, file:///$LIB/)
* configure: -auxbindir
* rc: disable_secret_security_check (for windows?)
diff --git a/fm.h b/fm.h
@@ -964,6 +964,9 @@ global int rc_dir_is_tmp init(FALSE);
global int use_mouse init(TRUE);
extern int mouseActive;
global int reverse_mouse init(FALSE);
+global int relative_wheel_scroll init(FALSE);
+global int fixed_wheel_scroll_count init(5);
+global int relative_wheel_scroll_ratio init(30);
#endif /* USE_MOUSE */
#ifdef USE_COOKIE
diff --git a/main.c b/main.c
@@ -4656,6 +4656,15 @@ stopI(void)
#ifdef USE_MOUSE
+static int
+mouse_scroll_line(void)
+{
+ if (relative_wheel_scroll)
+ return (relative_wheel_scroll_ratio * LASTLINE + 99) / 100;
+ else
+ return fixed_wheel_scroll_count;
+}
+
static TabBuffer *
posTab(int x, int y)
{
@@ -4814,21 +4823,21 @@ process_mouse(int btn, int x, int y)
#endif /* USE_MENU */
break;
case MOUSE_BTN4_DOWN_RXVT:
- for (i = 0; i < MOUSE_SCROLL_LINE; i++)
+ for (i = 0; i < mouse_scroll_line(); i++)
ldown1();
break;
case MOUSE_BTN5_DOWN_RXVT:
- for (i = 0; i < MOUSE_SCROLL_LINE; i++)
+ for (i = 0; i < mouse_scroll_line(); i++)
lup1();
break;
}
}
else if (btn == MOUSE_BTN4_DOWN_XTERM) {
- for (i = 0; i < MOUSE_SCROLL_LINE; i++)
+ for (i = 0; i < mouse_scroll_line(); i++)
ldown1();
}
else if (btn == MOUSE_BTN5_DOWN_XTERM) {
- for (i = 0; i < MOUSE_SCROLL_LINE; i++)
+ for (i = 0; i < mouse_scroll_line(); i++)
lup1();
}
diff --git a/menu.c b/menu.c
@@ -1085,7 +1085,6 @@ mSrchP(char c)
#define MOUSE_BTN5_DOWN_XTERM 65
#define MOUSE_BTN_UP 3
#define MOUSE_BTN_RESET -1
-#define MOUSE_SCROLL_LINE 5
static int
process_mMouse(int btn, int x, int y)
diff --git a/rc.c b/rc.c
@@ -164,6 +164,9 @@ static char *config_file = NULL;
#ifdef USE_MOUSE
#define CMT_MOUSE "マウスを使う"
#define CMT_REVERSE_MOUSE "マウスのドラッグ動作を逆にする"
+#define CMT_RELATIVE_WHEEL_SCROLL "ホイールでのスクロール速度の扱い"
+#define CMT_RELATIVE_WHEEL_SCROLL_RATIO "(Aのみ)画面の何%スクロールするか"
+#define CMT_FIXED_WHEEL_SCROLL_COUNT "(Bのみ)スクロールする行数"
#endif /* USE_MOUSE */
#define CMT_CLEAR_BUF "表示されていないバッファのメモリを開放する"
#define CMT_NOSENDREFERER "Referer: を送らないようにする"
@@ -310,6 +313,9 @@ static char *config_file = NULL;
#ifdef USE_MOUSE
#define CMT_MOUSE "Enable mouse"
#define CMT_REVERSE_MOUSE "Scroll in reverse direction of mouse drag"
+#define CMT_RELATIVE_WHEEL_SCROLL "Behavior of wheel scroll speed"
+#define CMT_RELATIVE_WHEEL_SCROLL_RATIO "(A only)Scroll by # % of screen"
+#define CMT_FIXED_WHEEL_SCROLL_COUNT "(B only)Scroll by # lines"
#endif /* USE_MOUSE */
#define CMT_CLEAR_BUF "Free memory of undisplayed buffers"
#define CMT_NOSENDREFERER "Suppress `Referer:' header"
@@ -433,6 +439,21 @@ static struct sel_c defaulturls[] = {
#endif
{0, NULL, NULL}
};
+#ifdef USE_MOUSE
+static struct sel_c wheelmode[] =
+{
+#if LANG == JA
+ {TRUE, "1", "A:画面サイズに比例"},
+ {FALSE, "0", "B:一定の行数"},
+ {0, NULL, NULL}
+#else /* LANG != JA */
+ {TRUE, "1", "A:relative to screen height"},
+ {FALSE, "0", "B:fixed speed"},
+ {0, NULL, NULL}
+#endif /* LANG != JA */
+};
+#endif /* MOUSE */
+
#ifdef INET6
static struct sel_c dnsorders[] = {
{N_S(DNS_ORDER_UNSPEC), "unspecified"},
@@ -589,6 +610,12 @@ struct param_ptr params3[] = {
{"use_mouse", P_INT, PI_ONOFF, (void *)&use_mouse, CMT_MOUSE, NULL},
{"reverse_mouse", P_INT, PI_ONOFF, (void *)&reverse_mouse,
CMT_REVERSE_MOUSE, NULL},
+ {"relative_wheel_scroll", P_INT, PI_SEL_C, (void *) &relative_wheel_scroll,
+ CMT_RELATIVE_WHEEL_SCROLL, wheelmode},
+ {"relative_wheel_scroll_ratio", P_INT, PI_TEXT, (void *) &relative_wheel_scroll_ratio,
+ CMT_RELATIVE_WHEEL_SCROLL_RATIO, NULL},
+ {"fixed_wheel_scroll_count", P_INT, PI_TEXT, (void *) &fixed_wheel_scroll_count,
+ CMT_FIXED_WHEEL_SCROLL_COUNT, NULL},
#endif /* USE_MOUSE */
{"clear_buffer", P_INT, PI_ONOFF, (void *)&clear_buffer, CMT_CLEAR_BUF,
NULL},
diff --git a/terms.h b/terms.h
@@ -37,7 +37,6 @@ extern int LINES, COLS;
#define MOUSE_BTN5_DOWN_XTERM 65
#define MOUSE_BTN_UP 3
#define MOUSE_BTN_RESET -1
-#define MOUSE_SCROLL_LINE 5
#ifdef __CYGWIN__
extern int is_xterm;