ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/msmouse.c
(Generate patch)

Comparing ray/src/rt/msmouse.c (file contents):
Revision 2.1 by greg, Thu Oct 8 16:20:48 1992 UTC vs.
Revision 2.6 by greg, Sat Feb 22 02:07:28 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
7 /*
8 * Microsoft Mouse handling routines
9 */
10
11 #include <stdio.h>
12 #include <dos.h>
4   #include <i86.h>
5   #include <graph.h>
6   #include "driver.h"
7  
8 + #define  NULL           0
9 +
10   #define  M_RIGHTBUTT    0x8
11   #define  M_LEFTBUTT     0x2
12   #define  M_MOTION       0x1
13  
14 < static int ydispsize;
14 > static int xdispsize, ydispsize;
15   static int crad;
16   #define right_button (mouse_event & M_RIGHTBUTT)
17   #define left_button (mouse_event & M_LEFTBUTT)
# Line 45 | Line 38 | int  newx, newy;
38          extern char  *bmalloc();
39          static char  *imp = NULL;
40          static int  curx = -1, cury = -1;
41 + #define xcmin           (curx-crad<0 ? 0 : curx-crad)
42 + #define ycmin           (cury-crad<0 ? 0 : cury-crad)
43 + #define xcmax           (curx+crad>=xdispsize ? xdispsize-1 : curx+crad)
44 + #define ycmax           (cury+crad>=ydispsize ? ydispsize-1 : cury+crad)
45  
46          if (imp == NULL &&
47                  (imp = bmalloc(_imagesize(0,0,2*crad+1,2*crad+1))) == NULL) {
# Line 52 | Line 49 | int  newx, newy;
49                  quit(1);
50          }
51          if (curx >= 0 & cury >= 0)      /* clear old cursor */
52 <                _putimage(curx-crad, cury-crad, imp, _GPSET);
52 >                _putimage(xcmin, ycmin, imp, _GPSET);
53                                          /* record new position */
54          curx = newx; cury = newy;
55          if (curx < 0 | cury < 0)
56                  return;         /* no cursor */
57                                          /* save under new cursor */
58 <        _getimage(newx-crad,newy-crad,newx+crad,newy+crad, imp);
58 >        _getimage(xcmin, ycmin, xcmax, ycmax, imp);
59                                          /* draw new cursor */
60          _setcolor(1);
61 <        _rectangle(_GFILLINTERIOR, newx-crad, newy-1, newx+crad, newy+1);
62 <        _rectangle(_GFILLINTERIOR, newx-1, newy-crad, newx+1, newy+crad);
61 >        _rectangle(_GFILLINTERIOR, xcmin, cury-1, xcmax, cury+1);
62 >        _rectangle(_GFILLINTERIOR, curx-1, ycmin, curx+1, ycmax);
63          _setcolor(0);
64 <        _moveto(newx-crad+1, newy);
65 <        _lineto(newx+crad-1, newy);
66 <        _moveto(newx, newy-crad+1);
67 <        _lineto(newx, newy+crad-1);
64 >        _moveto(xcmin+1, cury);
65 >        _lineto(xcmax-1, cury);
66 >        _moveto(curx, ycmin+1);
67 >        _lineto(curx, ycmax-1);
68 > #undef xcmin
69 > #undef ycmin
70 > #undef xcmax
71 > #undef ycmax
72   }
73  
74  
# Line 147 | Line 148 | struct driver  *dp;
148  
149      /* get relevant parameters */
150  
151 +    xdispsize = dp->xsiz;
152      ydispsize = dp->ysiz;
153      crad = dp->ysiz/40;
154  
155 +    /* set screen limits */
156 +
157 +    inregs.w.ax = 0x7;          /* horizontal resolution */
158 +    inregs.w.cx = 0;
159 +    inregs.w.dx = xdispsize-1;
160 +    int386x( 0x33, &inregs, &outregs, &sregs );
161 +    inregs.w.ax = 0x8;          /* vertical resolution */
162 +    inregs.w.cx = 0;
163 +    inregs.w.dx = ydispsize-1;
164 +    int386x( 0x33, &inregs, &outregs, &sregs );
165 +
166      /* install watcher */
167  
168      inregs.w.ax = 0xC;
# Line 161 | Line 174 | struct driver  *dp;
174  
175      dp->getcur = ms_getcur;
176   }
177 +
178 + void
179 + ms_gcdone( dp )
180 + struct driver  *dp;
181 + {
182 +    union REGS inregs, outregs;
183 +
184 +    if (dp->getcur != ms_getcur)
185 +        return;                 /* not installed */
186 +
187 +    dp->getcur = NULL;
188 +
189 +    /* uninstall watcher */
190 +
191 +    inregs.w.ax = 0;
192 +    int386 (0x33, &inregs, &outregs);
193 + }
194 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines