[gnu.emacs.bug] minor nit on X11 mouse support in the minibuffer

dave@CS.WISC.EDU (Dave Cohrs) (12/17/88)

18.52, as distributed, doesn't fully support the X11 mouse.  It works
fine for normal windows, but support for the minibuffer, when active,
just doesn't cut it.  You can't select it with the mouse, and you
can't reposition point using the mouse.  The following patches to
x11fns.c solve both of these problems.  I've been running emacs with
these mods for a couple weeks without any problems, so I'm pretty sure
of their correctness.

There were various problems, all in the coordinates-in-window-p
function:

- it assumed all windows have a mode line
- it wouldn't let you select the last line in the "screen"
  in any case
- it didn't take into account the width of the prompt that usually
  appears in the minibuffer when calculating relative coordinates.

Dave Cohrs

RCS file: RCS/x11fns.c,v
retrieving revision 1.1
diff -c -r1.1 x11fns.c
*** /tmp/,RCSt1a04978   Fri Dec 16 10:30:29 1988
--- x11fns.c    Fri Dec 16 10:25:18 1988
***************
*** 477,482 ****
--- 477,484 ----
       register Lisp_Object coordinate, window;
  {
        register Lisp_Object xcoord, ycoord;
+       extern Lisp_Object minibuf_window;
+       extern int minibuf_prompt_width;
  
        if (!CONSP (coordinate))
                wrong_type_argument (Qlistp, coordinate);
***************
*** 492,504 ****
                return Qnil;
  
        XFASTINT (xcoord) -= XFASTINT (XWINDOW (window)->left);
-       if (XINT (ycoord) == (screen_height - 1))
-               return Qnil;
  
!       if ((XINT (ycoord) < XINT (XWINDOW (window)->top)) ||
!           (XINT (ycoord) >= (XINT (XWINDOW (window)->top) +
!                              XINT (XWINDOW (window)->height)) - 1))
!               return Qnil;
  
        XFASTINT (ycoord) -= XFASTINT (XWINDOW (window)->top);
        return Fcons (xcoord, Fcons (ycoord, Qnil));
--- 494,514 ----
                return Qnil;
  
        XFASTINT (xcoord) -= XFASTINT (XWINDOW (window)->left);
  
!       if (window == minibuf_window) {
!               XFASTINT (xcoord) -= minibuf_prompt_width;
!               if(XINT (xcoord) < 0)
!                       XFASTINT (xcoord) = 0;
!               if ((XINT (ycoord) < XINT (XWINDOW (window)->top)) ||
!                   (XINT (ycoord) >= (XINT (XWINDOW (window)->top) +
!                                      XINT (XWINDOW (window)->height))))
!                       return Qnil;
!       } else {
!               if ((XINT (ycoord) < XINT (XWINDOW (window)->top)) ||
!                   (XINT (ycoord) >= (XINT (XWINDOW (window)->top) +
!                                      XINT (XWINDOW (window)->height)) - 1))
!                       return Qnil;
!       }
  
        XFASTINT (ycoord) -= XFASTINT (XWINDOW (window)->top);
        return Fcons (xcoord, Fcons (ycoord, Qnil));