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.2 by greg, Fri Oct 9 15:24:02 1992 UTC

# Line 4 | Line 4
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
6  
7 /*
8 * Microsoft Mouse handling routines
9 */
10
11 #include <stdio.h>
12 #include <dos.h>
7   #include <i86.h>
8   #include <graph.h>
9   #include "driver.h"
# Line 18 | Line 12 | static char SCCSid[] = "$SunId$ LBL";
12   #define  M_LEFTBUTT     0x2
13   #define  M_MOTION       0x1
14  
15 < static int ydispsize;
15 > static int xdispsize, ydispsize;
16   static int crad;
17   #define right_button (mouse_event & M_RIGHTBUTT)
18   #define left_button (mouse_event & M_LEFTBUTT)
# Line 33 | Line 27 | static void _loadds far mouse_handler (int max, int mc
27   #pragma aux mouse_handler parm [EAX] [ECX] [EDX]
28          mouse_event = max;
29          mouse_xpos = mcx;
30 <        mouse_ypos = mdx;
30 >        mouse_ypos = mdx * (long)ydispsize / 200;       /* kludge */
31   }
32   #pragma on (check_stack)
33  
# Line 45 | Line 39 | int  newx, newy;
39          extern char  *bmalloc();
40          static char  *imp = NULL;
41          static int  curx = -1, cury = -1;
42 + #define xcmin           (curx-crad<0 ? 0 : curx-crad)
43 + #define ycmin           (cury-crad<0 ? 0 : cury-crad)
44 + #define xcmax           (curx+crad>=xdispsize ? xdispsize-1 : curx+crad)
45 + #define ycmax           (cury+crad>=ydispsize ? ydispsize-1 : cury+crad)
46  
47          if (imp == NULL &&
48                  (imp = bmalloc(_imagesize(0,0,2*crad+1,2*crad+1))) == NULL) {
# Line 52 | Line 50 | int  newx, newy;
50                  quit(1);
51          }
52          if (curx >= 0 & cury >= 0)      /* clear old cursor */
53 <                _putimage(curx-crad, cury-crad, imp, _GPSET);
53 >                _putimage(xcmin, ycmin, imp, _GPSET);
54                                          /* record new position */
55          curx = newx; cury = newy;
56          if (curx < 0 | cury < 0)
57                  return;         /* no cursor */
58                                          /* save under new cursor */
59 <        _getimage(newx-crad,newy-crad,newx+crad,newy+crad, imp);
59 >        _getimage(xcmin, ycmin, xcmax, ycmax, imp);
60                                          /* draw new cursor */
61          _setcolor(1);
62 <        _rectangle(_GFILLINTERIOR, newx-crad, newy-1, newx+crad, newy+1);
63 <        _rectangle(_GFILLINTERIOR, newx-1, newy-crad, newx+1, newy+crad);
62 >        _rectangle(_GFILLINTERIOR, xcmin, cury-1, xcmax, cury+1);
63 >        _rectangle(_GFILLINTERIOR, curx-1, ycmin, curx+1, ycmax);
64          _setcolor(0);
65 <        _moveto(newx-crad+1, newy);
66 <        _lineto(newx+crad-1, newy);
67 <        _moveto(newx, newy-crad+1);
68 <        _lineto(newx, newy+crad-1);
65 >        _moveto(xcmin+1, cury);
66 >        _lineto(xcmax-1, cury);
67 >        _moveto(curx, ycmin+1);
68 >        _lineto(curx, ycmax-1);
69 > #undef xcmin
70 > #undef ycmin
71 > #undef xcmax
72 > #undef ycmax
73   }
74  
75  
# Line 147 | Line 149 | struct driver  *dp;
149  
150      /* get relevant parameters */
151  
152 +    xdispsize = dp->xsiz;
153      ydispsize = dp->ysiz;
154      crad = dp->ysiz/40;
155  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines