      subroutine getpoint(coordx,coordy,button)
c
c Initialize the mouse device and get a point from the screen in
c inches.
c Button:
c        left   = 1
c        middle = 2
c        right  = 3
c
c James Blake
c @(#)getpoint.f	1.1  4/3/89 
c
      include 'device_type.h'
      integer x,y,xlist(100),ylist(100),valid,choice,button
      character*80 string
      data x, y /16384, 16384/
c
c Initialize the graphics input device and number.
c
      if (color_ws .or. mono_ws) then
         call cfinitlid(0,1,x,y,xlist,ylist,n,val,choice,
     $                  string,segid,pickid)
c
c Associate mouse buttons to the event.
c
         call cfassoc(2,0,1)
         call cfassoc(3,0,1)
         call cfassoc(4,0,1)
c     
c Enable tracing of the mouse.
c
         call cftrackon(0,1,1,0,0,10000,10000,x,y,xlist,ylist,n,
     $                  val,choice,string,segid,pickid)
c
c Request a valid input event.
c
 10      call cfreqinp(0,1,-1,valid,itrig,x,y,xlist,ylist,n,
     $                 val,choice,string,segid,itrig,pickid)
c
         if (valid .ne. 0) goto 10 
c
c Dissociate the buttons and release the device.
c
         call cftrackoff(0,1,0,0)
         call cfdissoc(2,0,1)
         call cfdissoc(3,0,1)
         call cfdissoc(4,0,1)
         call cfrelidev(0,1)
         coordx = page_x(x) 
         coordy = page_y(y)
         button = itrig - 1
      endif
      return
      end
