in do_mouseinput(), deal with clicks of the first mouse button again;

oddly, ncurses built without --enable-ext-mouse needs this, but ncurses
built with --enable-ext-mouse doesn't


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4112 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2007-05-29 17:01:12 +00:00
parent 14aa37c692
commit 3a504709b7
2 changed files with 30 additions and 24 deletions

View File

@ -1,3 +1,9 @@
2007-05-29 David Lawrence Ramsey <pooka109@gmail.com>
* winio.c (do_mouseinput): Deal with clicks of the first mouse
button again. Oddly, ncurses built without --enable-ext-mouse
needs this, but ncurses built with --enable-ext-mouse doesn't.
2007-05-25 David Lawrence Ramsey <pooka109@gmail.com>
* configure.ac, nano.c (main): Replace the current hackish check
@ -21,7 +27,7 @@
Fix processing of mouse events so that those we don't handle are
ignored instead of being erroneously passed through.
* winio.c (do_mouseinput): Simplify handling of mouse events
involving the first mouse button.
involving the first mouse button by only dealing with releases.
* winio.c (do_mouseinput): Improve mouse wheel support to only
move the cursor if we're in the edit window or on the statusbar.

View File

@ -1622,17 +1622,17 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
#ifndef DISABLE_MOUSE
/* Handle any mouse events that may have occurred. We currently handle
* releases of the first mouse button. If allow_shortcuts is TRUE,
* releasing on a visible shortcut will put back the keystroke
* associated with that shortcut. If NCURSES_MOUSE_VERSION is at least
* 2, we also currently handle presses of the fourth mouse button
* (upward rolls of the mouse wheel) by putting back the keystrokes to
* move up, and presses of the fifth mouse button (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 handled, 1 if it's been
* handled by putting back keystrokes that need to be handled. or 2 if
* the mouse event is ignored. Assume that KEY_MOUSE has already been
* read in. */
* releases/clicks of the first mouse button. If allow_shortcuts is
* TRUE, releasing/clicking on a visible shortcut will put back the
* keystroke associated with that shortcut. If NCURSES_MOUSE_VERSION is
* at least 2, we also currently handle presses of the fourth mouse
* button (upward rolls of the mouse wheel) by putting back the
* keystrokes to move up, and presses of the fifth mouse button
* (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
* handled, 1 if 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)
{
MEVENT mevent;
@ -1648,13 +1648,13 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
*mouse_x = mevent.x;
*mouse_y = mevent.y;
/* Handle releases of the first mouse button. */
if (mevent.bstate & BUTTON1_RELEASED) {
/* Handle clicks/releases of the first mouse button. */
if (mevent.bstate & (BUTTON1_RELEASED | BUTTON1_CLICKED)) {
/* If we're allowing shortcuts, the current shortcut list is
* being displayed on the last two lines of the screen, and the
* first mouse button was pressed inside it, we need to figure
* out which shortcut was clicked and put back the equivalent
* keystroke(s) for it. */
* first mouse button was released on/clicked inside it, we need
* to figure out which shortcut was released on/clicked and put
* back the equivalent keystroke(s) for it. */
if (allow_shortcuts && !ISSET(NO_HELP) &&
wmouse_trafo(bottomwin, mouse_y, mouse_x, FALSE)) {
int i;
@ -1670,7 +1670,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
/* The actual shortcut we released on, starting at the
* first one in the current shortcut list. */
/* Ignore releases of the first mouse button on the
/* Ignore releases/clicks of the first mouse button on the
* statusbar. */
if (*mouse_y == 0)
return 2;
@ -1702,20 +1702,20 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
/* Calculate the x-coordinate relative to the beginning of
* the shortcut list in bottomwin, and add it to j. j
* should now be the index in the shortcut list of the
* shortcut we released on. */
* shortcut we released/clicked on. */
j = (*mouse_x / i) * 2 + j;
/* Adjust j if we released on the last two shortcuts. */
if ((j >= currslen) && (*mouse_x % i < COLS % i))
j -= 2;
/* Ignore releases of the first mouse button beyond the last
* shortcut. */
/* Ignore releases/clicks of the first mouse button beyond
* the last shortcut. */
if (j >= currslen)
return 2;
/* Go through the shortcut list to determine which shortcut
* we released on. */
* we released/clicked on. */
s = currshortcut;
for (; j > 0; j--)
@ -1732,8 +1732,8 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
return 1;
}
} else
/* Handle releases of the first mouse button that aren't on
* the current shortcut list elsewhere. */
/* Handle releases/clicks of the first mouse button that
* aren't on the current shortcut list elsewhere. */
return 0;
}
#if NCURSES_MOUSE_VERSION >= 2