diff --git a/ChangeLog b/ChangeLog
index cc5f95b93ab30a588bc24fbeeebe0b5270d500b2..cbc39225660547b705be710428e395344d96d5f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-05-22  David Lawrence Ramsey  <pooka109@gmail.com>
+
+	* browser.c (do_browser), nano.c (do_mouse), prompt.c
+	(do_statusbar_mouse, do_yesno_prompt), winio.c (do_mouseinput):
+	Simplify processing of mouse events.  Instead of calling
+	wenclose() to get the window a mouse event took place in and
+	manually adjusting the returned coordinates to be relative to
+	that window the mouse event took place in, call wmouse_trafo(),
+	which does both.
+
 2007-05-20  David Lawrence Ramsey  <pooka109@gmail.com>
 
 	* browser.c (do_browser), nano.c (do_mouse), prompt.c
diff --git a/src/browser.c b/src/browser.c
index b62debef041d5944261a60b7adb77f38442ecd95..0f10bb8c3de9eeb01a0087dc08d713594ce1fbb0 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -134,10 +134,8 @@ char *do_browser(char *path, DIR *dir)
 		    if (get_mouseinput(&mouse_x, &mouse_y, TRUE) == 0) {
 			/* We can click in the edit window to select a
 			 * filename. */
-			if (wenclose(edit, mouse_y, mouse_x)) {
-			    /* Subtract out the size of topwin. */
-			    mouse_y -= 2 - no_more_space();
-
+			if (wmouse_trafo(edit, &mouse_y, &mouse_x,
+				FALSE)) {
 			    /* longest is the width of each column.
 			     * There are two spaces between each
 			     * column. */
diff --git a/src/nano.c b/src/nano.c
index 68c8299ea8f9a0e111378f049c5d9118ceaea4ec..fe0dcbfdf5c533974c138ff81e3926469ac9cc04 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1498,7 +1498,7 @@ int do_mouse(void)
 
     if (retval == 0) {
 	/* We can click in the edit window to move the cursor. */
-	if (wenclose(edit, mouse_y, mouse_x)) {
+	if (wmouse_trafo(edit, &mouse_y, &mouse_x, FALSE)) {
 	    bool sameline;
 		/* Did they click on the line with the cursor?  If they
 		 * clicked on the cursor, we set the mark. */
@@ -1506,9 +1506,6 @@ int do_mouse(void)
 	    size_t current_x_save = openfile->current_x;
 	    size_t pww_save = openfile->placewewant;
 
-	    /* Subtract out the size of topwin. */
-	    mouse_y -= 2 - no_more_space();
-
 	    sameline = (mouse_y == openfile->current_y);
 
 	    /* Move to where the click occurred. */
diff --git a/src/prompt.c b/src/prompt.c
index 8bb080630e3830638ee8a07778c6009ab6ef9fef..85c78bf753ea2b329a00d1530632ab08a6f9a60e 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -281,16 +281,13 @@ int do_statusbar_mouse(void)
     if (retval == 0) {
 	/* We can click in the statusbar window text to move the
 	 * cursor. */
-	if (wenclose(bottomwin, mouse_y, mouse_x)) {
+	if (wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE)) {
 	    size_t start_col;
 
 	    assert(prompt != NULL);
 
 	    start_col = strlenpt(prompt) + 1;
 
-	    /* Subtract out the sizes of topwin and edit. */
-	    mouse_y -= (2 - no_more_space()) + editwinrows;
-
 	    /* Move to where the click occurred. */
 	    if (mouse_x > start_col && mouse_y == 0) {
 		size_t pww_save = statusbar_pww;
@@ -1338,16 +1335,14 @@ int do_yesno_prompt(bool all, const char *msg)
 #ifndef DISABLE_MOUSE
 	    case KEY_MOUSE:
 		if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&
-			wenclose(bottomwin, mouse_y, mouse_x) &&
-			!ISSET(NO_HELP) && mouse_x < (width * 2) &&
-			mouse_y - (2 - no_more_space()) -
-			editwinrows - 1 >= 0) {
+			wmouse_trafo(bottomwin, &mouse_y, &mouse_x,
+			FALSE) && !ISSET(NO_HELP) && mouse_x <
+			(width * 2) && mouse_y > 0) {
 		    int x = mouse_x / width;
 			/* Calculate the x-coordinate relative to the
 			 * two columns of the Yes/No/All shortcuts in
 			 * bottomwin. */
-		    int y = mouse_y - (2 - no_more_space()) -
-			editwinrows - 1;
+		    int y = mouse_y - 1;
 			/* Calculate the y-coordinate relative to the
 			 * beginning of the Yes/No/All shortcuts in
 			 * bottomwin, i.e. with the sizes of topwin,
diff --git a/src/winio.c b/src/winio.c
index 69c747aec48f594a101e94c7d8554b02ed17009a..ba8eccbe38ba7ce7c32b8985dbf40d781b5310f3 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1658,16 +1658,30 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
 	 * 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. */
-	if (allow_shortcuts && !ISSET(NO_HELP) && wenclose(bottomwin,
-		*mouse_y, *mouse_x)) {
-	    int i, j;
+	if (allow_shortcuts && !ISSET(NO_HELP) &&
+		wmouse_trafo(bottomwin, mouse_y, mouse_x, FALSE)) {
+	    int i;
+		/* The width of all the shortcuts, except for the last
+		 * two, in the shortcut list in bottomwin. */
+	    int j;
+		/* The y-coordinate relative to the beginning of the
+		 * shortcut list in bottomwin. */
 	    size_t currslen;
 		/* The number of shortcuts in the current shortcut
 		 * list. */
-	    const shortcut *s = currshortcut;
+	    const shortcut *s;
 		/* 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
+	     * statusbar. */
+	    if (*mouse_y == 0)
+		return 2;
+
+	    /* Calculate the y-coordinate relative to the beginning of
+	     * the shortcut list in bottomwin. */
+	    j = *mouse_y - 1;
+
 	    /* Get the shortcut lists' length. */
 	    if (currshortcut == main_list)
 		currslen = MAIN_VISIBLE;
@@ -1688,17 +1702,6 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
 	    else
 		i = COLS / ((currslen / 2) + (currslen % 2));
 
-	    /* Calculate the y-coordinate relative to the beginning of
-	     * the shortcut list in bottomwin, i.e. with the sizes of
-	     * topwin, edit, and the first line of bottomwin subtracted
-	     * out, and set j to it. */
-	    j = *mouse_y - (2 - no_more_space()) - editwinrows - 1;
-
-	    /* Ignore releases of the first mouse button on the
-	     * statusbar. */
-	    if (j < 0)
-		return 2;
-
 	    /* 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
@@ -1716,6 +1719,8 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
 
 	    /* Go through the shortcut list to determine which shortcut
 	     * we released on. */
+	    s = currshortcut;
+
 	    for (; j > 0; j--)
 		s = s->next;
 
@@ -1739,19 +1744,24 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
      * mouse wheel) and presses of the fifth mouse button (downward
      * rolls of the mouse wheel) . */
     else if (mevent.bstate & (BUTTON4_PRESSED | BUTTON5_PRESSED)) {
-	if (wenclose(edit, *mouse_y, *mouse_x) || wenclose(bottomwin,
-		*mouse_y, *mouse_x)) {
-	    /* Calculate the y-coordinate relative to the beginning of
-	     * the shortcut list in bottomwin, i.e. with the sizes of
-	     * topwin, edit, and the first line of bottomwin subtracted
-	     * out, and set i to it. */
-	    int i = *mouse_y - (2 - no_more_space()) - editwinrows - 1;
+	bool in_edit = wmouse_trafo(edit, mouse_y, mouse_x, FALSE);
+	bool in_bottomwin = wmouse_trafo(bottomwin, mouse_y, mouse_x,
+		FALSE);
+
+	if (in_edit || in_bottomwin) {
+	    int i;
+		/* The y-coordinate relative to the beginning of the
+		 * shortcut list in bottomwin. */
 
 	    /* Ignore presses of the fourth mouse button and presses of
 	     * the fifth mouse button below the statusbar. */
-	    if (i >= 0)
+	    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;
+
 	    /* One upward roll of the mouse wheel is equivalent to
 	     * moving up three lines, and one downward roll of the mouse
 	     * wheel is equivalent to moving down three lines. */