home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / haswinlib / c / pointer < prev    next >
Encoding:
Text File  |  1991-02-04  |  21.0 KB  |  588 lines

  1. /* > $.CLIB.C.pointer
  2.  *
  3.  *      HASWIN Graphics Library
  4.  *     =========================
  5.  *
  6.  *      Copyright (C) H.A.Shaw 1990.
  7.  *              Howard A. Shaw.
  8.  *              The Unit for Space Sciences,
  9.  *              Room 165,
  10.  *              Physics Building,
  11.  *              University of Kent at Canterbury.
  12.  *              Canterbury.
  13.  *              Kent.  CT2 7NJ
  14.  *      You may use and distribute this code freely, however please leave
  15.  *      it alone.  If you find bugs (and there will be many) please contact
  16.  *      me and the master source can be modified.  If you keep me informed
  17.  *      of who you give copies of this to then I can get release upgrades
  18.  *      to them.
  19.  *
  20.  *      Since the WIMP has but one pointer HASWIN impliments a pointer stack
  21.  *      to simplify coding of complex pointer switching.  HASWIN uses this
  22.  *      to allow each window to have its own pointer, but the code for that
  23.  *      is not here.
  24.  */
  25. #include "includes.h"
  26.  
  27. /*
  28.  *      this variable keeps things about the current pointer that we
  29.  *      well need to know, but the WIMP cannot tell us.  Note:
  30.  *      We determine mx, my, buttons, palette when required, and so don't
  31.  *      need to store them.
  32.  */
  33. static pointer haswin_pointer;
  34.  
  35. /*
  36.  *      When the program starts up we must load up the default pointer
  37.  *      information so that we get everything correct later on.  We assume
  38.  *      that at the moment of startup the pointer is the default one
  39.  *      "ptr_default".  This is a big assumption, but how else can we work?
  40.  *      This assumption allows us to put the pointer back corrently if we
  41.  *      terminate later after changing the pointer.  The clearup routines
  42.  *      call haswin_poppointer() until the stack is clear, and "ptr_default"
  43.  *      is always on the bottom of the stack.
  44.  */
  45. int haswin_initpointerinfo() {
  46.  
  47.         haswin_pointer.mx = 0;
  48.         haswin_pointer.my = 0;
  49.         haswin_pointer.ihandle = 0;
  50.         haswin_pointer.whandle = 0;
  51.         haswin_pointer.win = 0;
  52.         haswin_pointer.ic = 0;
  53.         strncpy(haswin_pointer.name, "ptr_default", POINTER_MAXDATA);
  54.         haswin_pointer.activex = 0;
  55.         haswin_pointer.activey = 0;
  56.         haswin_pointer.number = 1;
  57.         haswin_pointer.buttons = 0;
  58.         haswin_pointer.palette = haswin_malloc(sizeof(palette), "haswin_initpointerinfo", "new palette");
  59.         haswin_getpalette(haswin_pointer.palette);
  60.         return(HASWIN_TRUE);
  61. }
  62.  
  63. /*
  64.  *      this is given a pointer and fills it in.  If the given block is
  65.  *      a null pointer then a pointer structure is created.
  66.  *      The WIMP routine gives us the X/Y coords, window/icon handles and
  67.  *      the button state.  We turn the handles into window/icon pointers
  68.  *      and add the name, active x/y point and palette.
  69.  */
  70. pointer *haswin_getpointerinfo(pointer *point) {
  71.  
  72.         register int      i;
  73.         _kernel_swi_regs  regs;
  74.         buffer            buff;
  75.  
  76.         if (!point) {
  77.                 if ((point=haswin_malloc(sizeof(pointer), "haswin_getpointerinfo", "new pointer")) == 0)
  78.                         return(0);
  79.                 point->palette = 0;
  80.         }
  81.         regs.r[1] = (int)&buff;
  82.         if (!haswin_swi(HASWIN_Get_pointer_info, ®s))
  83.                  return(0);
  84.         point->mx = buff.i[0];
  85.         point->my = buff.i[1];
  86.         point->buttons = buff.i[2] & POINTER_MOUSEBUTTONS;
  87.         /* get keyboard status and update mouse buttons from it */
  88.         regs.r[0] = 0xCA;
  89.         regs.r[1] = 0x00;
  90.         regs.r[2] = 0xFF;
  91.         haswin_swi(OS_Byte, ®s);
  92.         if (regs.r[1] & 0x01)
  93.                 point->buttons |= POINTER_MOUSE_A;
  94.         if (regs.r[1] & 0x08)
  95.                 point->buttons |= POINTER_MOUSE_S;
  96.         if (regs.r[1] & 0x40)
  97.                 point->buttons |= POINTER_MOUSE_C;
  98.         point->whandle = buff.i[3];
  99.         point->ihandle = buff.i[4];
  100.         if (buff.i[3] == -1) {
  101.                 /* pointer over background */
  102.                 point->win = (window *)0;
  103.                 point->ic = (icon *)0;
  104.         } else {
  105.                 point->win = haswin_findwindowhandle(buff.i[3]);
  106.                 point->ic = haswin_findiconhandle(point->win, buff.i[4]);
  107.         }
  108.         strncpy(point->name, haswin_pointer.name, POINTER_MAXDATA);
  109.         point->activex = haswin_pointer.activex;
  110.         point->activey = haswin_pointer.activey;
  111.         point->number  = haswin_pointer.number;
  112.         if (haswin_pointer.palette) {
  113.                 if (!point->palette)
  114.                         point->palette = haswin_malloc(sizeof(palette), "haswin_getpointerinfo", "new palette");
  115.                 for (i=0; i<20; i++)
  116.                         point->palette->colour[i] = haswin_pointer.palette->colour[i];
  117.         } else
  118.                 point->palette = 0;
  119.         return(point);
  120. }
  121.  
  122. /*
  123.  *      move the pointer to the correct place
  124.  */
  125. int haswin_placepointer(window *wptr, int x, int y) {
  126.  
  127.         char                    pbuf[5];
  128.         _kernel_swi_regs        regs;
  129.         int                     placeok, *iptr;
  130.  
  131.         placeok = HASWIN_TRUE;
  132.         if ((int)wptr > 0) {
  133.                 haswin_updatewindowinfo(wptr);
  134.                 iptr = ((int *)wptr->win);
  135.                 x += iptr[0]-iptr[4];
  136.                 y += iptr[3]-iptr[5];
  137.                 if (x < iptr[0]) {
  138.                         x = iptr[0];
  139.                         placeok = HASWIN_FALSE;
  140.                 } else if (x > iptr[2]) {
  141.                         x = iptr[2];
  142.                         placeok = HASWIN_FALSE;
  143.                 }
  144.                 if (y < iptr[1]) {
  145.                         y = iptr[1];
  146.                         placeok = HASWIN_FALSE;
  147.                 } else if (y > iptr[3]) {
  148.                         y = iptr[3];
  149.                         placeok = HASWIN_FALSE;
  150.                 }
  151.         }
  152.         pbuf[0] = 3;    /* move the pointer OS_Word 21,3 */
  153.         pbuf[1] = (x%256) & 0xff;
  154.         pbuf[2] = (x/256) & 0xff;
  155.         pbuf[3] = (y%256) & 0xff;
  156.         pbuf[4] = (y/256) & 0xff;
  157.         regs.r[0] = 21;
  158.         regs.r[1] = (int)pbuf;
  159.         if (!haswin_swi(OS_Word, ®s))
  160.                 return(HASWIN_FALSE);
  161.         return(placeok);
  162. }
  163.  
  164. /*
  165.  *      Given a pointer structure change the pointer to the new shape
  166.  *      and select the pointer.  If move is HASWIN_TRUE then move to
  167.  *      the coords given by the pointer as well.
  168.  *      If we ask for an icon that is outside a window then move as close
  169.  *      as we can get, and return HASWIN_FALSE.  If we ask for a window
  170.  *      not on screen then do nothing and return HASWIN_FALSE.
  171.  */
  172. int haswin_setpointer(pointer *point, int move) {
  173.  
  174.         window                  *win;
  175.         icon                    *ic;
  176.         int                     i;
  177.         _kernel_swi_regs        regs;
  178.  
  179.         if (!point)
  180.                 return(HASWIN_FALSE);
  181.         if (point->name[0]) {
  182.                 /* have a name, so set the pointer shape */
  183.                 /* first look for sprite palette */
  184.                 regs.r[0] = 0x18;
  185.                 if (!haswin_spriteop(point->name, ®s)) {
  186.                         haswin_interrorprintf("haswin_setpointer: cannot set pointer to sprite '%s'", point->name);
  187.                         return(HASWIN_FALSE);
  188.                 }
  189.                 if (regs.r[1] == 0) {
  190.                         haswin_interrorprintf("haswin_setpointer: cannot set pointer to sprite '%s' in system area", point->name);
  191.                         return(HASWIN_FALSE);
  192.                 }
  193.                 regs.r[3] = point->number & 0x0F;
  194.                 if (regs.r[1] != 1) {
  195.                         /*
  196.                            If the sprite is in the WIMP area we cannot get
  197.                            the sprite pointer, therefore we have to assume
  198.                            that the screen mode is OK, otherwise for the
  199.                            pointer we MUST have a 2 bits per pixel mode.
  200.                            Check the sprite was defined in one of modes
  201.                            1,5,8,11,19,26
  202.                          */
  203.                         switch (((int *)(regs.r[2]))[10]) {
  204.                         case  1:
  205.                         case  5:
  206.                         case  8:
  207.                         case 11:
  208.                         case 19:
  209.                         case 26:
  210.                                 break;
  211.                         default:
  212.                                 haswin_interrorprintf("haswin_setpointer: cannot set pointer to sprite '%s', screen mode %d", point->name, ((int *)(regs.r[2]))[10]);
  213.                                 return(HASWIN_FALSE);
  214.                         }
  215.                         /*
  216.                            regs.r[2] points to sprite.  See RISCOS P.R.M.
  217.                            Vol I page 390 to see why if regs.r[2]+8words
  218.                            contains 0x2C there is no palette.
  219.                          */
  220.                         if (((int *)(regs.r[2]))[8] == 0x2C) {
  221.                                 /* we will not change the palette for the
  222.                                    pointer so we MUST reset the colours to
  223.                                    what they were when the pointer was set
  224.                                    up.
  225.                                  */
  226.                                 if (point->palette)
  227.                                         haswin_setpalette(point->palette);
  228.                                 regs.r[3] |= 0x20;
  229.                                         /* stop sprite palette use */
  230.                         }
  231.                 }
  232.                 regs.r[4] = point->activex;
  233.                 regs.r[5] = point->activey;
  234.                 regs.r[6] = 0;
  235.                 regs.r[7] = 0;
  236.                 regs.r[0] = 0x24;
  237.                 if (!haswin_spriteop(point->name, ®s)) {
  238.                         haswin_interrorprintf("haswin_setpointer: cannot set pointer to sprite '%s'", point->name);
  239.                         return(HASWIN_FALSE);
  240.                 }
  241.         }
  242.         if (move) {
  243.                 if (point->ic) {
  244.                         ic = point->ic;
  245.                         win = haswin_findwindowhandle(point->ic->whandle);
  246.                         if ((point->win) && (point->win != win)) {
  247.                                 /* something odd, icon not in window given */
  248.                                 return(HASWIN_FALSE);
  249.                         }
  250.                 } else if (point->win) {
  251.                         win = point->win;
  252.                         ic = 0;
  253.                 } else {
  254.                         win = 0;
  255.                         ic  = 0;
  256.                 }
  257.                 if (win) {
  258.                         haswin_updatewindowinfo(win);
  259.                         i = haswin_getwindowflags(win);
  260.                         if ((i & WINDOW_OPEN) == 0) {
  261.                                 /* can't put pointer in closed window ! */
  262.                                 return(HASWIN_FALSE);
  263.                         }
  264.                         if (ic)
  265.                                 i = haswin_placepointer(win, (ic->ic[0]+ic->ic[2])/2, (ic->ic[1]+ic->ic[3])/2);
  266.                         else
  267.                                 i = haswin_placepointer(win, point->mx, point->my);
  268.                 } else
  269.                         i = haswin_placepointer(0, point->mx, point->my);
  270.         }
  271.         strncpy(haswin_pointer.name, point->name, POINTER_MAXDATA);
  272.         haswin_pointer.activex = point->activex;
  273.         haswin_pointer.activey = point->activey;
  274.         haswin_pointer.number  = point->number;
  275.         haswin_getpalette(haswin_pointer.palette);
  276.  
  277.         /* update pointer structure with real mouse position */
  278.         haswin_getpointerinfo(point);
  279.         return(HASWIN_TRUE);
  280. }
  281.  
  282. /*
  283.  *      we can stack pointers up to HASWIN_MAXPOINTERS levels
  284.  */
  285. #define HASWIN_MAXPOINTERS 16
  286. static pointer haswin_pointerstack[HASWIN_MAXPOINTERS];
  287. static int     haswin_pointerstackptr = 0;
  288.  
  289. /*
  290.  *      push the current pointer onto the pointer stack and set a 
  291.  *      new pointer if we can.
  292.  */
  293. int haswin_pushpointer(pointer *point, int move) {
  294.  
  295.         if ((!point) || (haswin_pointerstackptr == HASWIN_MAXPOINTERS))
  296.                 return(HASWIN_FALSE);
  297.         haswin_getpointerinfo(&haswin_pointerstack[haswin_pointerstackptr++]);
  298.         haswin_setpointer(point, move);
  299.         return(HASWIN_TRUE);
  300. }
  301.  
  302. /*
  303.  *      pull a pointer from the pointer stack if we can
  304.  */
  305. int haswin_poppointer(int move) {
  306.  
  307.         if (haswin_pointerstackptr <= 0)
  308.                 return(HASWIN_FALSE);
  309.         haswin_setpointer(&haswin_pointerstack[--haswin_pointerstackptr], move);
  310.         return(HASWIN_TRUE);
  311. }
  312.  
  313. /*
  314.  *      create a new pointer structure
  315.  */
  316. pointer *haswin_makepointer(char *name, int actx, int acty) {
  317.  
  318.         _kernel_swi_regs        regs;
  319.         pointer                 *point;
  320.  
  321.         if (name) {
  322.                 regs.r[0] = 0x18;
  323.                 if (!haswin_spriteop(name, ®s)) {
  324.                         haswin_interrorprintf("haswin_makepointer: cannot make pointer from sprite '%s' - not found", name);
  325.                         return(0);
  326.                 }
  327.                 if (regs.r[1] == 0) {
  328.                         haswin_interrorprintf("haswin_makepointer: cannot make pointer from sprite '%s' - in system area", name);
  329.                         return(0);
  330.                 }
  331.                 /*
  332.                    for pointer we MUST have a 2 bits per pixel mode.  Check
  333.                    the sprite was defined in one of 1,5,8,11,19,26
  334.                  */
  335.                 switch (((int *)(regs.r[2]))[10]) {
  336.                 case  1:
  337.                 case  5:
  338.                 case  8:
  339.                 case 11:
  340.                 case 19:
  341.                 case 26:
  342.                         break;
  343.                 default:
  344.                         haswin_interrorprintf("haswin_makepointer: cannot make pointer from sprite '%s' - screen mode %d", name, ((int *)(regs.r[2]))[10]);
  345.                         return(0);
  346.                 }
  347.         }
  348.         point = (pointer *)haswin_malloc(sizeof(pointer), "haswin_makepointer", "pointer block");
  349.         if (name)
  350.                 strncpy(point->name, name, POINTER_MAXDATA);
  351.         else
  352.                 point->name[0] = 0;
  353.         point->activex = actx;
  354.         point->activey = acty;
  355.         point->number = 2;      /* by default use pointer 2 */
  356.         point->palette = (palette *)0;
  357.         point->win = 0;
  358.         point->ic = 0;
  359.         point->ihandle = 0;
  360.         point->whandle = 0;
  361.         return(point);
  362. }
  363.  
  364. /*
  365.  *      the WIMP returns different codes for the three mouse buttons
  366.  *      depending upon the work area button type, or icon button type
  367.  *      beneath the pointer when the button was pressed.  This is a real
  368.  *      pain, and so HASWIN uses internal button codes that are always
  369.  *      the same.  The next two routines convert between the types.
  370.  */
  371. /*
  372.  *      this table contains entries for each button type.  If it
  373.  *      can SELECT, DRAG, DOUBLE or is WRITABLE
  374.  */
  375. #define SELECT   0
  376. #define DRAG     1
  377. #define DOUBLE   2
  378. #define WRITABLE 3
  379. static char haswin_buttoncodes[16][4] = {
  380. /*  0 never             */  { 0, 0, 0, 0 },
  381. /*  1 always            */  { 1, 0, 0, 0 },
  382. /*  2 auto-repeat       */  { 1, 0, 0, 0 },
  383. /*  3 click             */  { 1, 0, 0, 0 },
  384. /*  4 release           */  { 1, 0, 0, 0 },
  385. /*  5 Double click      */  { 0, 0, 1, 0 },
  386. /*  6 Click/Drag        */  { 1, 1, 0, 0 },
  387. /*  7 Release/Drag      */  { 1, 1, 0, 0 },
  388. /*  8 Double/Drag       */  { 0, 1, 1, 0 },
  389. /*  9 Menu              */  { 1, 0, 0, 0 },
  390. /* 10 Double/Click/Drag */  { 1, 1, 1, 0 },
  391. /* 11 Radio             */  { 1, 1, 0, 0 },
  392. /* 12 Silent            */  { 0, 0, 0, 0 },
  393. /* 13                   */  { 0, 0, 0, 0 },
  394. /* 14 Write/Click/Drag  */  { 1, 1, 0, 1 },
  395. /* 15 Writeable         */  { 1, 0, 0, 1 }
  396. };
  397.  
  398. int haswin_canbuttondouble(int button) {
  399.  
  400.         return(haswin_buttoncodes[button&0x0F][DOUBLE]);
  401. }
  402.  
  403. int haswin_canbuttondrag(int button) {
  404.  
  405.         return(haswin_buttoncodes[button&0x0F][DRAG]);
  406. }
  407.  
  408. int haswin_canbuttonselect(int button) {
  409.  
  410.         return(haswin_buttoncodes[button&0x0F][SELECT]);
  411. }
  412.  
  413. int haswin_canbuttonwrite(int button) {
  414.  
  415.         return(haswin_buttoncodes[button&0x0F][WRITABLE]);
  416. }
  417.  
  418. /*
  419.  *      given a returned button code return HASWIN_TRUE if the type
  420.  *      allows double clicks or drags.
  421.  */
  422. int haswin_canbuttontwice(int button) {
  423.  
  424.         return(haswin_buttoncodes[button&0x0F][DOUBLE] ||
  425.                haswin_buttoncodes[button&0x0F][DRAG]);
  426. }
  427.  
  428. /*
  429.  *      given a window, an icon and an internal button code work out
  430.  *      which button was really pressed and return HASWIN button type
  431.  *      codes.  The icon takes priority over the window.
  432.  */
  433. int haswin_buttonHASWINtoWIMP(window *wptr, icon *iptr, int button) {
  434.  
  435.         int     tmp;
  436.  
  437.         if (button == 0)
  438.                 return(0);
  439.         if (iptr)
  440.                 tmp = iptr->button;
  441.         else if ((int)wptr > 0)
  442.                 tmp = wptr->button;
  443.         else
  444.                 tmp = 0;
  445.         switch (tmp) {
  446.         case  0:
  447.         case 12:
  448.                 return(0);
  449.                 break;
  450.         case 13:
  451.                 break;
  452.         case  1:
  453.         case  2:
  454.         case  3:
  455.         case  4:
  456.         case  9:
  457.                 switch (button) {
  458.                 case HASWIN_MOUSE_L:     return(0x004);
  459.                 case HASWIN_MOUSE_M:     return(0x002);
  460.                 case HASWIN_MOUSE_R:     return(0x001);
  461.                 }
  462.                 break;
  463.         case  5:
  464.                 switch (button) {
  465.                 case HASWIN_MOUSE_LDOUB: return(0x004);
  466.                 case HASWIN_MOUSE_M:     return(0x002);
  467.                 case HASWIN_MOUSE_RDOUB: return(0x001);
  468.                 }
  469.                 break;
  470.         case  6:
  471.         case  7:
  472.         case 11:
  473.         case 14:
  474.         case 15:
  475.                 switch (button) {
  476.                 case HASWIN_MOUSE_L:     return(0x004);
  477.                 case HASWIN_MOUSE_M:     return(0x002);
  478.                 case HASWIN_MOUSE_R:     return(0x001);
  479.                 case HASWIN_MOUSE_LDRAG: return(0x040);
  480.                 case HASWIN_MOUSE_RDRAG: return(0x010);
  481.                 }
  482.                 break;
  483.         case  8:
  484.                 switch (button) {
  485.                 case HASWIN_MOUSE_LDOUB: return(0x004);
  486.                 case HASWIN_MOUSE_M:     return(0x002);
  487.                 case HASWIN_MOUSE_RDOUB: return(0x001);
  488.                 case HASWIN_MOUSE_LDRAG: return(0x040);
  489.                 case HASWIN_MOUSE_RDRAG: return(0x010);
  490.                 }
  491.                 break;
  492.         case 10:
  493.                 switch (button) {
  494.                 case HASWIN_MOUSE_LDOUB: return(0x004);
  495.                 case HASWIN_MOUSE_M:     return(0x002);
  496.                 case HASWIN_MOUSE_RDOUB: return(0x001);
  497.                 case HASWIN_MOUSE_LDRAG: return(0x040);
  498.                 case HASWIN_MOUSE_RDRAG: return(0x010);
  499.                 case HASWIN_MOUSE_L:     return(0x400);
  500.                 case HASWIN_MOUSE_R:     return(0x100);
  501.                 }
  502.                 break;
  503.         }
  504.         return(0);
  505. }
  506.  
  507. /*
  508.  *      given a window, an icon and a WIMP button code
  509.  *      work out which button was really pressed and return HASWIN button
  510.  *      type codes.
  511.  */
  512. int haswin_buttonWIMPtoHASWIN(window *wptr, icon *iptr, int button) {
  513.  
  514.         int     tmp;
  515.  
  516.         if (iptr)
  517.                 tmp = iptr->button;
  518.         else if ((int)wptr > 0)
  519.                 tmp = wptr->button;
  520.         else
  521.                 tmp = 0;
  522.         /*
  523.          *      determine the codes for the button type we have
  524.          */
  525.         switch (tmp) {
  526.         case  0:
  527.         case 12:
  528.                 return(0);
  529.                 break;
  530.         case 13:
  531.                 break;
  532.         case  1:
  533.         case  2:
  534.         case  3:
  535.         case  4:
  536.         case  9:
  537.                 switch (button) {
  538.                 case 0x004: return(HASWIN_MOUSE_L);
  539.                 case 0x002: return(HASWIN_MOUSE_M);
  540.                 case 0x001: return(HASWIN_MOUSE_R);
  541.                 }
  542.                 break;
  543.         case  5:
  544.                 switch (button) {
  545.                 case 0x004: return(HASWIN_MOUSE_LDOUB);
  546.                 case 0x002: return(HASWIN_MOUSE_M);
  547.                 case 0x001: return(HASWIN_MOUSE_RDOUB);
  548.                 }
  549.                 break;
  550.         case  6:
  551.         case  7:
  552.         case 11:
  553.         case 14:
  554.         case 15:
  555.                 switch (button) {
  556.                 case 0x004: return(HASWIN_MOUSE_L);
  557.                 case 0x002: return(HASWIN_MOUSE_M);
  558.                 case 0x001: return(HASWIN_MOUSE_R);
  559.                 case 0x040: return(HASWIN_MOUSE_LDRAG);
  560.                 case 0x010: return(HASWIN_MOUSE_RDRAG);
  561.                 }
  562.                 break;
  563.         case  8:
  564.                 switch (button) {
  565.                 case 0x004: return(HASWIN_MOUSE_LDOUB);
  566.                 case 0x002: return(HASWIN_MOUSE_M);
  567.                 case 0x001: return(HASWIN_MOUSE_RDOUB);
  568.                 case 0x040: return(HASWIN_MOUSE_LDRAG);
  569.                 case 0x010: return(HASWIN_MOUSE_RDRAG);
  570.                 }
  571.                 break;
  572.         case 10:
  573.                 switch (button) {
  574.                 case 0x004: return(HASWIN_MOUSE_LDOUB);
  575.                 case 0x002: return(HASWIN_MOUSE_M);
  576.                 case 0x001: return(HASWIN_MOUSE_RDOUB);
  577.                 case 0x040: return(HASWIN_MOUSE_LDRAG);
  578.                 case 0x010: return(HASWIN_MOUSE_RDRAG);
  579.                 case 0x400: return(HASWIN_MOUSE_L);
  580.                 case 0x100: return(HASWIN_MOUSE_R);
  581.                 }
  582.                 break;
  583.         }
  584.         return(0);
  585. }
  586.  
  587.  
  588.