in get_mouseinput(), gix longstanding problem where mouse clicks on the
statusbar prompt text wouldn't be recognized unless the NO_HELP flag was turned off git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4187 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
9bd537fc6c
Коммит
97a6ecbd62
@ -1,3 +1,9 @@
|
|||||||
|
2007-12-07 David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
|
|
||||||
|
* winio.c (get_mouseinput): Fix longstanding problem where mouse
|
||||||
|
clicks on the statusbar prompt text wouldn't be recognized
|
||||||
|
unless the NO_HELP flag was turned off.
|
||||||
|
|
||||||
2007-12-04 David Lawrence Ramsey <pooka109@gmail.com>
|
2007-12-04 David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
|
|
||||||
* nano.c (main), prompt.c (get_prompt_string), winio.c
|
* nano.c (main), prompt.c (get_prompt_string), winio.c
|
||||||
|
58
src/winio.c
58
src/winio.c
@ -1621,7 +1621,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
/* Handle any mouse events that may have occurred. We currently handle
|
/* Handle any mouse event that may have occurred. We currently handle
|
||||||
* releases/clicks of the first mouse button. If allow_shortcuts is
|
* releases/clicks of the first mouse button. If allow_shortcuts is
|
||||||
* TRUE, releasing/clicking on a visible shortcut will put back the
|
* TRUE, releasing/clicking on a visible shortcut will put back the
|
||||||
* keystroke associated with that shortcut. If NCURSES_MOUSE_VERSION is
|
* keystroke associated with that shortcut. If NCURSES_MOUSE_VERSION is
|
||||||
@ -1629,13 +1629,16 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||||||
* button (upward rolls of the mouse wheel) by putting back the
|
* button (upward rolls of the mouse wheel) by putting back the
|
||||||
* keystrokes to move up, and presses of the fifth mouse button
|
* keystrokes to move up, and presses of the fifth mouse button
|
||||||
* (downward rolls of the mouse wheel) by putting back the keystrokes to
|
* (downward rolls of the mouse wheel) by putting back the keystrokes to
|
||||||
* move down. Return -1 on error, 0 if the mouse event needs to be
|
* move down. We also store the coordinates of a mouse event that needs
|
||||||
* handled, 1 if it's been handled by putting back keystrokes that need
|
* to be handled in mouse_x and mouse_y, relative to the entire screen.
|
||||||
* to be handled. or 2 if it's been ignored. Assume that KEY_MOUSE has
|
* Return -1 on error, 0 if the mouse event needs to be handled, 1 if
|
||||||
* already been read in. */
|
* it's been handled by putting back keystrokes that need to be handled.
|
||||||
|
* or 2 if it's been ignored. Assume that KEY_MOUSE has already been
|
||||||
|
* read in. */
|
||||||
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||||
{
|
{
|
||||||
MEVENT mevent;
|
MEVENT mevent;
|
||||||
|
bool in_bottomwin;
|
||||||
|
|
||||||
*mouse_x = -1;
|
*mouse_x = -1;
|
||||||
*mouse_y = -1;
|
*mouse_y = -1;
|
||||||
@ -1648,6 +1651,8 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
|||||||
*mouse_x = mevent.x;
|
*mouse_x = mevent.x;
|
||||||
*mouse_y = mevent.y;
|
*mouse_y = mevent.y;
|
||||||
|
|
||||||
|
in_bottomwin = wenclose(bottomwin, *mouse_y, *mouse_x);
|
||||||
|
|
||||||
/* Handle releases/clicks of the first mouse button. */
|
/* Handle releases/clicks of the first mouse button. */
|
||||||
if (mevent.bstate & (BUTTON1_RELEASED | BUTTON1_CLICKED)) {
|
if (mevent.bstate & (BUTTON1_RELEASED | BUTTON1_CLICKED)) {
|
||||||
/* If we're allowing shortcuts, the current shortcut list is
|
/* If we're allowing shortcuts, the current shortcut list is
|
||||||
@ -1655,8 +1660,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
|||||||
* first mouse button was released on/clicked inside it, we need
|
* first mouse button was released on/clicked inside it, we need
|
||||||
* to figure out which shortcut was released on/clicked and put
|
* to figure out which shortcut was released on/clicked and put
|
||||||
* back the equivalent keystroke(s) for it. */
|
* back the equivalent keystroke(s) for it. */
|
||||||
if (allow_shortcuts && !ISSET(NO_HELP) &&
|
if (allow_shortcuts && !ISSET(NO_HELP) && in_bottomwin) {
|
||||||
wmouse_trafo(bottomwin, mouse_y, mouse_x, FALSE)) {
|
|
||||||
int i;
|
int i;
|
||||||
/* The width of all the shortcuts, except for the last
|
/* The width of all the shortcuts, except for the last
|
||||||
* two, in the shortcut list in bottomwin. */
|
* two, in the shortcut list in bottomwin. */
|
||||||
@ -1670,10 +1674,20 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
|||||||
/* The actual shortcut we released on, starting at the
|
/* The actual shortcut we released on, starting at the
|
||||||
* first one in the current shortcut list. */
|
* first one in the current shortcut list. */
|
||||||
|
|
||||||
/* Ignore releases/clicks of the first mouse button on the
|
/* Translate the mouse event coordinates so that they're
|
||||||
* statusbar. */
|
* relative to bottomwin. */
|
||||||
if (*mouse_y == 0)
|
wmouse_trafo(bottomwin, mouse_y, mouse_x, FALSE);
|
||||||
return 2;
|
|
||||||
|
/* Handle releases/clicks of the first mouse button on the
|
||||||
|
* statusbar elsewhere. */
|
||||||
|
if (*mouse_y == 0) {
|
||||||
|
/* Restore the untranslated mouse event coordinates, so
|
||||||
|
* that they're relative to the entire screen again. */
|
||||||
|
*mouse_x = mevent.x;
|
||||||
|
*mouse_y = mevent.y;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the y-coordinate relative to the beginning of
|
/* Calculate the y-coordinate relative to the beginning of
|
||||||
* the shortcut list in bottomwin. */
|
* the shortcut list in bottomwin. */
|
||||||
@ -1741,24 +1755,14 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
|||||||
* mouse wheel) and presses of the fifth mouse button (downward
|
* mouse wheel) and presses of the fifth mouse button (downward
|
||||||
* rolls of the mouse wheel) . */
|
* rolls of the mouse wheel) . */
|
||||||
else if (mevent.bstate & (BUTTON4_PRESSED | BUTTON5_PRESSED)) {
|
else if (mevent.bstate & (BUTTON4_PRESSED | BUTTON5_PRESSED)) {
|
||||||
bool in_edit = wmouse_trafo(edit, mouse_y, mouse_x, FALSE);
|
bool in_edit = wenclose(edit, mouse_y, mouse_x);
|
||||||
bool in_bottomwin = wmouse_trafo(bottomwin, mouse_y, mouse_x,
|
|
||||||
FALSE);
|
|
||||||
|
|
||||||
if (in_edit || in_bottomwin) {
|
if (in_bottomwin)
|
||||||
int i;
|
/* Translate the mouse event coordinates so that they're
|
||||||
/* The y-coordinate relative to the beginning of the
|
* relative to bottomwin. */
|
||||||
* shortcut list in bottomwin. */
|
wmouse_trafo(bottomwin, mouse_y, mouse_x, FALSE);
|
||||||
|
|
||||||
/* Ignore presses of the fourth mouse button and presses of
|
|
||||||
* the fifth mouse button below the statusbar. */
|
|
||||||
if (in_bottomwin && *mouse_y > 0)
|
|
||||||
return 2;
|
|
||||||
|
|
||||||
/* Calculate the y-coordinate relative to the beginning of
|
|
||||||
* the shortcut list in bottomwin. */
|
|
||||||
i = *mouse_y - 1;
|
|
||||||
|
|
||||||
|
if (in_edit || (in_bottomwin && *mouse_y == 0)) {
|
||||||
/* One upward roll of the mouse wheel is equivalent to
|
/* One upward roll of the mouse wheel is equivalent to
|
||||||
* moving up three lines, and one downward roll of the mouse
|
* moving up three lines, and one downward roll of the mouse
|
||||||
* wheel is equivalent to moving down three lines. */
|
* wheel is equivalent to moving down three lines. */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user