diff options
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 57 | ||||
-rw-r--r-- | display.c | 26 | ||||
-rw-r--r-- | doc-jp/README.func | 4 | ||||
-rw-r--r-- | doc/README.func | 4 | ||||
-rw-r--r-- | fm.h | 27 | ||||
-rw-r--r-- | func.c | 191 | ||||
-rw-r--r-- | funcname.tab | 6 | ||||
-rw-r--r-- | main.c | 246 | ||||
-rw-r--r-- | menu.c | 25 | ||||
-rw-r--r-- | proto.h | 16 | ||||
-rw-r--r-- | rc.c | 4 |
11 files changed, 415 insertions, 191 deletions
@@ -1,5 +1,60 @@ 2002-11-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03478] mouse action configuration + * display.c (displayBuffer): mouse_menu -> mouse_action.menu_str + mouse_action.lastline_str + (redrawNLine): mouse_menu -> mouse_action.menu_str + * fm.h (MouseMenuMap): deleted + (MouseActionMap): added + (MouseAction): added + (mouse_action): added + * func.c (default_mouse_action): added + (setMouseAction0): added + (setMouseAction1): added + (setMouseAction2): added + (initMouseMenu): deleted + (initMouseAction): added + * funcname.tab (CLOSE_TAB_MOUSE): added + (MENU_MOUSE): added + (MOVE_MOUSE): added + (TAB_MOUSE): added + * main.c (main): initMouseMenu() -> initMouseAction() + mouse_menu -> mouse_action + (posTab): mouse_menu -> mouse_action + check y > LastTab->y + (mouse_menu_action): deleted + (do_mouse_action): added + (process_mouse): mouse_menu -> mouse_action + do_mouse_action() + (movMs): added + (menuMs): added + (tabMs): added + (closeTMs): added + (reinit): initMouseMenu() -> initMouseAction() + resource: MOUSE_MENU -> MOUSE + (calcTabPos): mouse_menu -> mouse_action + * menu.c (mainMn): mouse_menu -> mouse_action + (selMn): mouse_menu -> mouse_action + (tabMn): mouse_menu -> mouse_action + (initMenu): add SelectTag to w3mMenuList + * proto.h (movMs): added + (menuMs): added + (tabMs): added + (closeTMs): added + (initMouseMenu): deleted + (initMouseAction): added + * rc.c (sync_with_option): initMouseMenu() -> initMouseAction() + * doc/README.func (CLOSE_TAB_MOUSE): added + (MENU_MOUSE): added + (MOVE_MOUSE): added + (TAB_MOUSE): added + * doc-jp/README.func (CLOSE_TAB_MOUSE): added + (MENU_MOUSE): added + (MOVE_MOUSE): added + (TAB_MOUSE): added + +2002-11-26 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03476] Re: Bug#170506: w3m: Unable to use mozilla bugzilla * file.c (HTMLtagproc1): initialize ignore_tag in table_mode (HTMLtagproc0): check table_level @@ -5077,4 +5132,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.552 2002/11/25 16:39:52 ukai Exp $ +$Id: ChangeLog,v 1.553 2002/11/25 16:57:16 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: display.c,v 1.38 2002/11/22 15:43:13 ukai Exp $ */ +/* $Id: display.c,v 1.39 2002/11/25 16:57:16 ukai Exp $ */ #include <signal.h> #include "fm.h" @@ -254,7 +254,11 @@ displayBuffer(Buffer *buf, int mode) else buf->rootX = 0; buf->COLS = COLS - buf->rootX; - if (nTab > 1 || mouse_menu) { + if (nTab > 1 +#ifdef USE_MOUSE + || mouse_action.menu_str +#endif + ) { ny = LastTab->y + 2; if (ny > LASTLINE) ny = LASTLINE; @@ -318,12 +322,8 @@ displayBuffer(Buffer *buf, int mode) #endif #ifdef USE_MOUSE - if (use_mouse) -#if LANG == JA - msg = Strnew_charp("≪↑↓"); -#else /* LANG != JA */ - msg = Strnew_charp("<=UpDn "); -#endif /* LANG != JA */ + if (use_mouse && mouse_action.lastline_str) + msg = Strnew_charp(mouse_action.lastline_str); else #endif /* not USE_MOUSE */ msg = Strnew(); @@ -445,14 +445,18 @@ redrawNLine(Buffer *buf, int n) #endif /* USE_BG_COLOR */ } #endif /* USE_COLOR */ - if (nTab > 1 || mouse_menu) { + if (nTab > 1 +#ifdef USE_MOUSE + || mouse_action.menu_str +#endif + ) { TabBuffer *t; int l; move(0, 0); #ifdef USE_MOUSE - if (mouse_menu && mouse_menu->str) - addstr(mouse_menu->str); + if (mouse_action.menu_str) + addstr(mouse_action.menu_str); #endif clrtoeolx(); for (t = FirstTab; t; t = t->nextTab) { diff --git a/doc-jp/README.func b/doc-jp/README.func index c4d2ea2..5dd3a14 100644 --- a/doc-jp/README.func +++ b/doc-jp/README.func @@ -7,6 +7,7 @@ BOOKMARK ブックマークを読み込みます CENTER_H カーソルのある位置を行の中央に移動します CENTER_V カーソルのある行を画面の中央に移動します CLOSE_TAB 現在のタブを閉じます +CLOSE_TAB_MOUSE マウスカーソルの位置のタブを閉じます(マウス操作用) COMMAND w3mのコマンドを実行します COOKIE クッキー一覧を表示します DEFINE_KEY キー入力とコマンドの対応を定義します @@ -49,11 +50,13 @@ MARK_MID Message-ID風の文字列を,news:のリンクにします MARK_URL URL風の文字列をリンクにします MARK_WORD カーソルのある語をリンクにします MENU メニューを立ち上げます +MENU_MOUSE マウスカーソルの位置でメニューを立ち上げます(マウス操作用) MOUSE_TOGGLE マウスの有効/無効をトグルする MOVE_DOWN カーソルを下に移動します(改ページ時には半ページスクロール) MOVE_DOWN1 カーソルを下に移動します(改ページ時には1行スクロール) MOVE_LEFT カーソルを左に移動します(左端の場合には半画面分シフト) MOVE_LEFT1 カーソルを左に移動します(左端の場合には1文字分シフト) +MOVE_MOUSE カーソルをマウスカーソルの位置に移動します(マウス操作用) MOVE_RIGHT カーソルを右に移動します(右端の場合には半画面分シフト) MOVE_RIGHT1 カーソルを右に移動します(右端の場合には1文字分シフト) MOVE_UP カーソルを上に移動します(改ページ時には半ページスクロール) @@ -118,6 +121,7 @@ TAB_GOTO_RELATIVE 相対URLを指定して新しいタブで開きます TAB_LEFT 現在のタブを左に移動します TAB_LINK リンクが指す先の文書を新しいタブで開きます TAB_MENU タブ選択メニューを立ち上げます +TAB_MOUSE マウスカーソルの位置のタブに移動します(マウス操作用) TAB_RIGHT 現在のタブを右に移動します UP 画面を1行上にスクロールします VERSION w3m のバージョンを表示します diff --git a/doc/README.func b/doc/README.func index 4a02b2b..39bcdb3 100644 --- a/doc/README.func +++ b/doc/README.func @@ -7,6 +7,7 @@ BOOKMARK Read bookmark CENTER_H Move to the center line CENTER_V Move to the center column CLOSE_TAB Close current tab +CLOSE_TAB_MOUSE Close tab on mouse cursor (for mouse action) COMMAND Execute w3m command(s) COOKIE View cookie list DEFINE_KEY Define a binding between a key stroke and a user command @@ -49,11 +50,13 @@ MARK_MID Mark Message-ID-like strings as anchors MARK_URL Mark URL-like strings as anchors MARK_WORD Mark current word as anchor MENU Popup menu +MENU_MOUSE Popup menu at mouse cursor (for mouse action) MOUSE_TOGGLE Toggle activity of mouse MOVE_DOWN Move cursor down (a half screen scroll at the end of screen) MOVE_DOWN1 Move cursor down (1 line scroll at the end of screen) MOVE_LEFT Move cursor left (a half screen shift at the left edge) MOVE_LEFT1 Move cursor left (1 columns shift at the left edge) +MOVE_MOUSE Move cursor to mouse cursor (for mouse action) MOVE_RIGHT Move cursor right (a half screen shift at the right edge) MOVE_RIGHT1 Move cursor right (1 columns shift at the right edge) MOVE_UP Move cursor up (a half screen scroll at the top of screen) @@ -118,6 +121,7 @@ TAB_GOTO_RELATIVE Open relative URL on new tab TAB_LEFT Move current tab left TAB_LINK Open current link on new tab TAB_MENU Popup tab selection menu +TAB_MOUSE Move to tab on mouse cursor (for mouse action) TAB_RIGHT Move current tab right UP Scroll up one line VERSION Display version of w3m @@ -1,4 +1,4 @@ -/* $Id: fm.h,v 1.87 2002/11/22 15:43:14 ukai Exp $ */ +/* $Id: fm.h,v 1.88 2002/11/25 16:57:17 ukai Exp $ */ /* * w3m: WWW wo Miru utility * @@ -993,22 +993,27 @@ 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); -typedef struct _MouseMenuMap { +typedef struct _MouseActionMap { void (*func) (); char *data; -} MouseMenuMap; -typedef struct _MouseMenu { - char *str; - int width; +} MouseActionMap; +typedef struct _MouseAction { + char *menu_str; + char *lastline_str; + int menu_width; + int lastline_width; int in_action; int cursorX; int cursorY; - MouseMenuMap *map[3]; -} MouseMenu; -global MouseMenu *mouse_menu init(NULL); + MouseActionMap default_map[3]; + MouseActionMap anchor_map[3]; + MouseActionMap active_map[3]; + MouseActionMap tab_map[3]; + MouseActionMap *menu_map[3]; + MouseActionMap *lastline_map[3]; +} MouseAction; +global MouseAction mouse_action; #define LIMIT_MOUSE_MENU 100 -#else -#define mouse_menu NULL #endif /* USE_MOUSE */ #ifdef USE_COOKIE @@ -1,4 +1,4 @@ -/* $Id: func.c,v 1.14 2002/11/22 15:57:29 ukai Exp $ */ +/* $Id: func.c,v 1.15 2002/11/25 16:57:17 ukai Exp $ */ /* * w3m func.c */ @@ -322,15 +322,125 @@ getQWord(char **str) } #ifdef USE_MOUSE +static MouseAction default_mouse_action = { + NULL, +#if LANG == JA + "≪↑↓", +#else + "<=UpDn", +#endif + 0, 6, FALSE, 0, 0, + { { movMs, NULL }, { backBf, NULL }, { menuMs, NULL } }, /* default */ + { { NULL, NULL }, { NULL, NULL }, { NULL, NULL } }, /* anchor */ + { { followA, NULL }, { NULL, NULL }, { NULL, NULL } }, /* active */ + { { tabMs, NULL }, { closeTMs, NULL }, { NULL, NULL } }, /* tab */ + { NULL, NULL, NULL }, /* menu */ + { NULL, NULL, NULL } /* lastline */ +}; +static MouseActionMap default_lastline_action[6] = { + { backBf, NULL }, + { backBf, NULL }, + { pgBack, NULL }, + { pgBack, NULL }, + { pgFore, NULL }, + { pgFore, NULL } +}; + +static void +setMouseAction0(char **str, int *width, MouseActionMap **map, char *p) +{ + char *s; + int b, w, x; + + s = getQWord(&p); + if (!*s) { + *str = NULL; + width = 0; + for (b = 0; b < 3; b++) + map[b] = NULL; + return; + } + w = *width; + *str = s; + *width = strlen(s); + if (*width >= LIMIT_MOUSE_MENU) + *width = LIMIT_MOUSE_MENU; + if (*width <= w) + return; + for (b = 0; b < 3; b++) { + if (!map[b]) + continue; + map[b] = New_Reuse(MouseActionMap, map[b], *width); + for (x = w + 1; x < *width; x++) { + map[b][x].func = NULL; + map[b][x].data = NULL; + } + } +} + +static void +setMouseAction1(MouseActionMap **map, int width, char *p) +{ + char *s; + int x, x2, f; + + if (!*map) { + *map = New_N(MouseActionMap, width); + for (x = 0; x < width; x++) { + (*map)[x].func = NULL; + (*map)[x].data = NULL; + } + } + s = getWord(&p); + x = atoi(s); + if (!(IS_DIGIT(*s) && x >= 0 && x < width)) + return; /* error */ + s = getWord(&p); + x2 = atoi(s); + if (!(IS_DIGIT(*s) && x2 >= 0 && x2 < width)) + return; /* error */ + s = getWord(&p); + f = getFuncList(s); + s = getQWord(&p); + if (!*s) + s = NULL; + for (; x <= x2; x++) { + (*map)[x].func = (f >= 0) ? w3mFuncList[f].func : NULL; + (*map)[x].data = s; + } +} + +static void +setMouseAction2(MouseActionMap *map, char *p) +{ + char *s; + int f; + + s = getWord(&p); + f = getFuncList(s); + s = getQWord(&p); + if (!*s) + s = NULL; + map->func = (f >= 0) ? w3mFuncList[f].func : NULL; + map->data = s; +} + void -initMouseMenu(void) +initMouseAction(void) { FILE *mf; Str line; char *p, *s; - int f, b, x, x2; + int b, x, width; + MouseActionMap *map; + + bcopy((void *)&default_mouse_action, (void *)&mouse_action, + sizeof(default_mouse_action)); + mouse_action.lastline_map[0] = New_N(MouseActionMap, 6); + bcopy((void *)&default_lastline_action, + (void *)mouse_action.lastline_map[0], + sizeof(default_lastline_action)); - mouse_menu = NULL; if ((mf = fopen(rcFile(MOUSE_FILE), "rt")) == NULL) return; @@ -345,50 +455,47 @@ initMouseMenu(void) if (*s == '#') /* comment */ continue; if (!strcmp(s, "menu")) { - s = getQWord(&p); - if (!*s) - continue; /* error */ - mouse_menu = New(MouseMenu); - mouse_menu->str = s; - mouse_menu->width = strlen(s); - mouse_menu->in_action = FALSE; - if (mouse_menu->width >= LIMIT_MOUSE_MENU) - mouse_menu->width = LIMIT_MOUSE_MENU; - for (b = 0; b < 3; b++) { - mouse_menu->map[b] = New_N(MouseMenuMap, mouse_menu->width); - for (x = 0; x < mouse_menu->width; x++) { - mouse_menu->map[b][x].func = NULL; - mouse_menu->map[b][x].data = NULL; - } - } + setMouseAction0(&mouse_action.menu_str, &mouse_action.menu_width, + mouse_action.menu_map, p); + continue; + } + else if (!strcmp(s, "lastline")) { + setMouseAction0(&mouse_action.lastline_str, + &mouse_action.lastline_width, + mouse_action.lastline_map, p); + continue; } - if (!mouse_menu) - continue; /* "menu" is not set */ if (strcmp(s, "button")) continue; /* error */ s = getWord(&p); - b = atoi(s); - if (!(b >= 1 && b <= 3)) - continue; /* error */ - s = getWord(&p); - x = atoi(s); - if (!(IS_DIGIT(*s) && x >= 0 && x < mouse_menu->width)) - continue; /* error */ - s = getWord(&p); - x2 = atoi(s); - if (!(IS_DIGIT(*s) && x2 >= 0 && x2 < mouse_menu->width)) + b = atoi(s) - 1; + if (!(b >= 0 && b <= 2)) continue; /* error */ - s = getWord(&p); - f = getFuncList(s); - if (f < 0) - continue; /* error */ - s = getQWord(&p); - if (!*s) - s = NULL; - for (; x <= x2; x++) { - mouse_menu->map[b - 1][x].func = w3mFuncList[f].func; - mouse_menu->map[b - 1][x].data = s; + SKIP_BLANKS(p); + if (IS_DIGIT(*p)) + s = "menu"; + else + s = getWord(&p); + if (!strcasecmp(s, "menu")) { + if (!mouse_action.menu_str) + continue; + setMouseAction1(&mouse_action.menu_map[b], mouse_action.menu_width, + p); + } + else if (!strcasecmp(s, "lastline")) { + if (!mouse_action.lastline_str) + continue; + setMouseAction1(&mouse_action.lastline_map[b], + mouse_action.lastline_width, p); } + else if (!strcasecmp(s, "default")) + setMouseAction2(&mouse_action.default_map[b], p); + else if (!strcasecmp(s, "anchor")) + setMouseAction2(&mouse_action.anchor_map[b], p); + else if (!strcasecmp(s, "active")) + setMouseAction2(&mouse_action.active_map[b], p); + else if (!strcasecmp(s, "tab")) + setMouseAction2(&mouse_action.tab_map[b], p); } fclose(mf); } diff --git a/funcname.tab b/funcname.tab index 69e418f..795dfff 100644 --- a/funcname.tab +++ b/funcname.tab @@ -1,4 +1,4 @@ -# $Id: funcname.tab,v 1.14 2002/11/21 16:15:57 ukai Exp $ +# $Id: funcname.tab,v 1.15 2002/11/25 16:57:17 ukai Exp $ # macro name function name #---------------------------- @@@ nulcmd @@ -11,6 +11,7 @@ BOOKMARK ldBmark CENTER_H ctrCsrH CENTER_V ctrCsrV CLOSE_TAB closeT +CLOSE_TAB_MOUSE closeTMs COMMAND execCmd COOKIE cooLst DEFINE_KEY defKey @@ -54,12 +55,14 @@ MARK_MID chkNMID MARK_URL chkURL MARK_WORD chkWORD MENU mainMn +MENU_MOUSE menuMs MOUSE mouse MOUSE_TOGGLE msToggle MOVE_DOWN movD MOVE_DOWN1 movD1 MOVE_LEFT movL MOVE_LEFT1 movL1 +MOVE_MOUSE movMs MOVE_RIGHT movR MOVE_RIGHT1 movR1 MOVE_UP movU @@ -126,6 +129,7 @@ TAB_GOTO_RELATIVE tabrURL TAB_LEFT tabL TAB_LINK tabA TAB_MENU tabMn +TAB_MOUSE tabMs TAB_RIGHT tabR UP lup1 VERSION dispVer @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.152 2002/11/22 15:43:14 ukai Exp $ */ +/* $Id: main.c,v 1.153 2002/11/25 16:57:17 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -754,7 +754,7 @@ main(int argc, char **argv, char **envp) #endif /* not SIGWINCH */ initKeymap(TRUE); #ifdef USE_MOUSE - initMouseMenu(); + initMouseAction(); #endif /* MOUSE */ #ifdef USE_MENU initMenu(); @@ -1017,8 +1017,7 @@ main(int argc, char **argv, char **envp) CurrentKeyData = NULL; /* get keypress event */ #ifdef USE_MOUSE - if (mouse_menu) - mouse_menu->in_action = FALSE; + mouse_action.in_action = FALSE; if (use_mouse) mouse_active(); #endif /* USE_MOUSE */ @@ -4806,8 +4805,10 @@ posTab(int x, int y) { TabBuffer *tab; - if (mouse_menu && x < mouse_menu->width && y == 0) + if (mouse_action.menu_str && x < mouse_action.menu_width && y == 0) return NO_TABBUFFER; + if (y > LastTab->y) + return NULL; for (tab = FirstTab; tab; tab = tab->nextTab) { if (tab->x1 <= x && x <= tab->x2 && tab->y == y) return tab; @@ -4816,10 +4817,14 @@ posTab(int x, int y) } static void -mouse_menu_action(int btn, int x, int y) +do_mouse_action(int btn, int x, int y) { - if (!mouse_menu) - return; + MouseActionMap *map = NULL; + int ny = -1; + + if (nTab > 1 || mouse_action.menu_str) + ny = LastTab->y + 1; + switch (btn) { case MOUSE_BTN1_DOWN: btn = 0; @@ -4833,14 +4838,54 @@ mouse_menu_action(int btn, int x, int y) default: return; } - if (x >= 0 && x < mouse_menu->width && mouse_menu->map[btn][x].func) { - mouse_menu->in_action = TRUE; - mouse_menu->cursorX = x; - mouse_menu->cursorY = y; + if (y < ny) { + if (mouse_action.menu_str && x >= 0 && x < mouse_action.menu_width) { + if (mouse_action.menu_map[btn]) + map = &mouse_action.menu_map[btn][x]; + } + else + map = &mouse_action.tab_map[btn]; + } + else if (y == LASTLINE) { + if (mouse_action.lastline_str && x >= 0 && + x < mouse_action.lastline_width) { + if (mouse_action.lastline_map[btn]) + map = &mouse_action.lastline_map[btn][x]; + } + } + else if (y > ny) { + if (y == Currentbuf->cursorY + Currentbuf->rootY && + (x == Currentbuf->cursorX + Currentbuf->rootX +#ifdef JP_CHARSET + || (Currentbuf->currentLine != NULL && + (Currentbuf->currentLine->propBuf[Currentbuf->pos] & PC_KANJI1) + && x == Currentbuf->cursorX + Currentbuf->rootX + 1) +#endif /* JP_CHARSET */ + )) { + if (retrieveCurrentAnchor(Currentbuf) || + retrieveCurrentForm(Currentbuf)) + map = &mouse_action.active_map[btn]; + } + else { + int cx = Currentbuf->cursorX, cy = Currentbuf->cursorY; + cursorXY(Currentbuf, x - Currentbuf->rootX, + y - Currentbuf->rootY); + if (retrieveCurrentAnchor(Currentbuf) || + retrieveCurrentForm(Currentbuf)) + map = &mouse_action.anchor_map[btn]; + cursorXY(Currentbuf, cx, cy); + } + } + if (!(map && map->func)) + map = &mouse_action.default_map[btn]; + if (map && map->func) { + mouse_action.in_action = TRUE; + mouse_action.cursorX = x; + mouse_action.cursorY = y; CurrentKey = -1; CurrentKeyData = NULL; - CurrentCmdData = mouse_menu->map[btn][x].data; - (*mouse_menu->map[btn][x].func) (); + CurrentCmdData = map->data; + (*map->func) (); CurrentCmdData = NULL; } } @@ -4851,34 +4896,17 @@ process_mouse(int btn, int x, int y) int delta_x, delta_y, i; static int press_btn = MOUSE_BTN_RESET, press_x, press_y; TabBuffer *t; - int ny = 0; + int ny = -1; - if (nTab > 1 || mouse_menu) + if (nTab > 1 || mouse_action.menu_str) ny = LastTab->y + 1; if (btn == MOUSE_BTN_UP) { switch (press_btn) { case MOUSE_BTN1_DOWN: - if (ny && y < ny) { - if (press_y == y && press_x == x) { -#if 0 - if (y == 0 && x >= COLS - 2) { - deleteTab(CurrentTab); - displayBuffer(Currentbuf, B_FORCE_REDRAW); - return; - } -#endif - t = posTab(x, y); - if (t == NULL) - return; - if (t == NO_TABBUFFER) { - mouse_menu_action(press_btn, x, y); - return; - } - CurrentTab = t; - displayBuffer(Currentbuf, B_FORCE_REDRAW); - return; - } - else if (press_y < ny) { + if (press_y == y && press_x == x) + do_mouse_action(press_btn, x, y); + else if (ny > 0 && y < ny) { + if (press_y < ny) { moveTab(posTab(press_x, press_y), posTab(x, y), (press_y == y) ? (press_x < x) : (press_y < y)); return; @@ -4911,7 +4939,7 @@ process_mouse(int btn, int x, int y) } return; } - if (press_x != x || press_y != y) { + else { delta_x = x - press_x; delta_y = y - press_y; @@ -4940,77 +4968,11 @@ process_mouse(int btn, int x, int y) col1R(); } } - else { - if (y == LASTLINE) { - switch (x) { - case 0: - case 1: - backBf(); - break; - case 2: - case 3: - pgBack(); - break; - case 4: - case 5: - pgFore(); - break; - } - return; - } - if (y == Currentbuf->cursorY + Currentbuf->rootY && - (x == Currentbuf->cursorX + Currentbuf->rootX -#ifdef JP_CHARSET - || (Currentbuf->currentLine != NULL && - (Currentbuf->currentLine-> - propBuf[Currentbuf->pos] & PC_KANJI1) - && x == Currentbuf->cursorX + Currentbuf->rootX + 1) -#endif /* JP_CHARSET */ - )) { - followA(); - return; - } - if (x >= Currentbuf->rootX) - cursorXY(Currentbuf, x - Currentbuf->rootX, - y - Currentbuf->rootY); - displayBuffer(Currentbuf, B_NORMAL); - - } break; case MOUSE_BTN2_DOWN: - if (ny && y < ny) { - if (press_y == y && press_x == x) { - t = posTab(x, y); - if (t == NULL) - return; - if (t == NO_TABBUFFER) { - mouse_menu_action(press_btn, x, y); - return; - } - deleteTab(t); - displayBuffer(Currentbuf, B_FORCE_REDRAW); - } - return; - } - backBf(); - break; case MOUSE_BTN3_DOWN: - if (ny && y < ny) { - if (press_y == y && press_x == x) { - t = posTab(x, y); - if (t == NO_TABBUFFER) { - mouse_menu_action(press_btn, x, y); - return; - } - } - } -#ifdef USE_MENU - if (x >= Currentbuf->rootX && y > ny) - cursorXY(Currentbuf, x - Currentbuf->rootX, - y - Currentbuf->rootY); - onA(); - mainMenu(x, y); -#endif /* USE_MENU */ + if (press_y == y && press_x == x) + do_mouse_action(press_btn, x, y); break; case MOUSE_BTN4_DOWN_RXVT: for (i = 0; i < mouse_scroll_line(); i++) @@ -5131,6 +5093,70 @@ sysm_process_mouse(int x, int y, int nbs, int obs) return 0; } #endif /* USE_SYSMOUSE */ + +void +movMs(void) +{ + if (!mouse_action.in_action) + return; + if ((nTab > 1 || mouse_action.menu_str) && + mouse_action.cursorY < LastTab->y + 1) + return; + else if (mouse_action.cursorX >= Currentbuf->rootX && + mouse_action.cursorY < LASTLINE) { + cursorXY(Currentbuf, mouse_action.cursorX - Currentbuf->rootX, + mouse_action.cursorY - Currentbuf->rootY); + onA(); + } + displayBuffer(Currentbuf, B_NORMAL); +} + +#ifdef USE_MENU +void +menuMs(void) +{ + if (!mouse_action.in_action) + return; + if ((nTab > 1 || mouse_action.menu_str) && + mouse_action.cursorY < LastTab->y + 1) + mouse_action.cursorX -= 2; + else if (mouse_action.cursorX >= Currentbuf->rootX && + mouse_action.cursorY < LASTLINE) { + cursorXY(Currentbuf, mouse_action.cursorX - Currentbuf->rootX, + mouse_action.cursorY - Currentbuf->rootY); + onA(); + } + mainMn(); +} +#endif + +void +tabMs(void) +{ + TabBuffer *tab; + + if (!mouse_action.in_action) + return; + tab = posTab(mouse_action.cursorX, mouse_action.cursorY); + if (!tab || tab == NO_TABBUFFER) + return; + CurrentTab = tab; + displayBuffer(Currentbuf, B_FORCE_REDRAW); +} + +void +closeTMs(void) +{ + TabBuffer *tab; + + if (!mouse_action.in_action) + return; + tab = posTab(mouse_action.cursorX, mouse_action.cursorY); + if (!tab || tab == NO_TABBUFFER) + return; + deleteTab(tab); + displayBuffer(Currentbuf, B_FORCE_REDRAW); +} #endif /* USE_MOUSE */ void @@ -5515,7 +5541,7 @@ reinit() #endif initKeymap(TRUE); #ifdef USE_MOUSE - initMouseMenu(); + initMouseAction(); #endif #ifdef USE_MENU initMenu(); @@ -5547,8 +5573,8 @@ reinit() } #ifdef USE_MOUSE - if (!strcasecmp(resource, "MOUSE_MENU")) { - initMouseMenu(); + if (!strcasecmp(resource, "MOUSE")) { + initMouseAction(); return; } #endif @@ -5674,7 +5700,7 @@ calcTabPos(void) int n1, n2, na, nx, ny, ix, iy; #ifdef USE_MOUSE - lcol = mouse_menu ? mouse_menu->width : 0; + lcol = mouse_action.menu_str ? mouse_action.menu_width : 0; #endif if (nTab <= 0) @@ -1,4 +1,4 @@ -/* $Id: menu.c,v 1.19 2002/11/22 15:43:14 ukai Exp $ */ +/* $Id: menu.c,v 1.20 2002/11/25 16:57:17 ukai Exp $ */ /* * w3m menu.c */ @@ -1263,9 +1263,9 @@ mainMn(void) menu = w3mMenuList[n].menu; } #ifdef USE_MOUSE - if (mouse_menu && mouse_menu->in_action) { - x = mouse_menu->cursorX - FRAME_WIDTH - 1; - y = mouse_menu->cursorY; + if (mouse_action.in_action) { + x = mouse_action.cursorX; + y = mouse_action.cursorY; } #endif popupMenu(x, y, menu); @@ -1282,9 +1282,9 @@ selMn(void) y = Currentbuf->cursorY + Currentbuf->rootY; #ifdef USE_MOUSE - if (mouse_menu && mouse_menu->in_action) { - x = mouse_menu->cursorX - FRAME_WIDTH - 1; - y = mouse_menu->cursorY; + if (mouse_action.in_action) { + x = mouse_action.cursorX; + y = mouse_action.cursorY; } #endif popupMenu(x, y, &SelectMenu); @@ -1427,9 +1427,9 @@ tabMn(void) y = Currentbuf->cursorY + Currentbuf->rootY; #ifdef USE_MOUSE - if (mouse_menu && mouse_menu->in_action) { - x = mouse_menu->cursorX - FRAME_WIDTH - 1; - y = mouse_menu->cursorY; + if (mouse_action.in_action) { + x = mouse_action.cursorX; + y = mouse_action.cursorY; } #endif popupMenu(x, y, &SelTabMenu); @@ -1599,7 +1599,10 @@ initMenu(void) w3mMenuList[1].id = "Select"; w3mMenuList[1].menu = &SelectMenu; w3mMenuList[1].item = NULL; - w3mMenuList[2].id = NULL; + w3mMenuList[2].id = "SelectTab"; + w3mMenuList[2].menu = &SelTabMenu; + w3mMenuList[2].item = NULL; + w3mMenuList[3].id = NULL; if ((mf = fopen(rcFile(MENU_FILE), "rt")) == NULL) goto create_menu; @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.61 2002/11/24 16:02:22 ukai Exp $ */ +/* $Id: proto.h,v 1.62 2002/11/25 16:57:17 ukai Exp $ */ /* * This file was automatically generated by version 1.7 of cextract. * Manual editing not recommended. @@ -607,9 +607,21 @@ extern void mouse_end(void); extern void mouse_active(void); extern void mouse_inactive(void); extern void msToggle(void); +extern void movMs(void); +#ifdef USE_MENU +extern void menuMs(void); +#else +#define menuMs nulcmd +#endif +extern void tabMs(void); +extern void closeTMs(void); #else /* not USE_MOUSE */ #define mouse nulcmd #define msToggle nulcmd +#define movMs nulcmd +#define menuMs nulcmd +#define tabMs nulcmd +#define closeTMs nulcmd #endif /* not USE_MOUSE */ #ifdef USE_IMAGE @@ -631,7 +643,7 @@ extern char *getKeyData(int key); extern char *getWord(char **str); extern char *getQWord(char **str); #ifdef USE_MOUSE -extern void initMouseMenu(void); +extern void initMouseAction(void); #endif #ifdef USE_MENU @@ -1,4 +1,4 @@ -/* $Id: rc.c,v 1.66 2002/11/21 16:31:36 ukai Exp $ */ +/* $Id: rc.c,v 1.67 2002/11/25 16:57:17 ukai Exp $ */ /* * Initialization file etc. */ @@ -1323,7 +1323,7 @@ sync_with_option(void) if (fmInitialized) { initKeymap(FALSE); #ifdef USE_MOUSE - initMouseMenu(); + initMouseAction(); #endif /* MOUSE */ #ifdef USE_MENU initMenu(); |