home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / ibm / AIX / aixMouse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-16  |  3.4 KB  |  132 lines

  1. /*
  2.  * $XConsortium: aixMouse.c,v 1.3 91/07/16 13:00:48 jap Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1988,1989,1990,1991
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * License to use, copy, modify, and distribute this software and its
  9.  * documentation for any purpose and without fee is hereby granted,
  10.  * provided that the above copyright notice appear in all copies and that
  11.  * both that copyright notice and this permission notice appear in
  12.  * supporting documentation, and that the name of IBM not be
  13.  * used in advertising or publicity pertaining to distribution of the
  14.  * software without specific, written prior permission.
  15.  *
  16.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS, AND 
  18.  * NONINFRINGEMENT OF THIRD PARTY RIGHTS, IN NO EVENT SHALL
  19.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  20.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  22.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  23.  * SOFTWARE.
  24.  *
  25. */
  26.  
  27. #include <stdio.h>
  28. #include <sys/hft.h>
  29.  
  30. #include "X.h"
  31. #include "Xproto.h"
  32. #include "miscstruct.h"
  33. #include "scrnintstr.h"
  34. #include "input.h"
  35. #include "cursorstr.h"
  36.  
  37. #include "ibmIO.h"
  38. #include "ibmMouse.h"
  39. #include "ibmScreen.h"
  40.  
  41. #include "ibmTrace.h"
  42. #include "hftQueue.h"
  43.  
  44. #include "AIX.h"
  45. #include "AIXext.h"
  46.  
  47. extern  char    *getenv();
  48.  
  49. /***================================================================***/
  50.  
  51. static int
  52. rtGetMotionEvents(buff, start, stop, pScr)
  53.     CARD32 start, stop;
  54.     xTimecoord *buff;
  55.     ScreenPtr pScr;
  56. {
  57.     TRACE(("rtGetMotionEvents( buff= 0x%x, start= %d, stop= %d )\n",
  58.                                                     buff,start,stop));
  59.     return 0;
  60. }
  61.  
  62. /***================================================================***/
  63.  
  64. static unsigned always0= 0;
  65. #define BUTTONMAPSIZE   5
  66.  
  67.  
  68. #ifdef AIXV3
  69. extern int hftQFD;
  70. #endif
  71.  
  72. int
  73. AIXMouseProc(pDev, onoff)
  74.     DevicePtr   pDev;
  75.     int onoff;
  76. {
  77.     BYTE map[BUTTONMAPSIZE];
  78.  
  79. #ifdef AIXV3
  80.     struct hfchgloc hf_info;
  81. #endif
  82.  
  83.     TRACE(("AIXMouseProc( pDev= 0x%x, onoff= 0x%x )\n",pDev, onoff ));
  84.  
  85.     switch (onoff)
  86.     {
  87.     case DEVICE_INIT:
  88.         ibmPtr = pDev;
  89.         map[1] = Button1;
  90.         map[2] = Button2;
  91.         map[3] = Button3;
  92.         map[4] = Button4;
  93.         InitPointerDeviceStruct(
  94.             ibmPtr, map, BUTTONMAPSIZE, rtGetMotionEvents, ibmChangePointerControl, 0);
  95.         SetInputCheck( &hftPending, &always0 );
  96.  
  97. #ifdef AIXV3
  98.         /* Set mouse sample rate, resolution, threshhold, and scale.
  99.            Ideally, the default values should be okay, but they're not,
  100.            so this is neccessary to make the mouse smooth. -- EWu 8/17/89 */
  101.  
  102.         hf_info.hf_cmd = HFMRATE;
  103.         hf_info.loc_value1 = 60;
  104.         if (ioctl(hftQFD,HFCHGLOC,&hf_info)<0) perror("mouse ioctl rate");
  105.  
  106.         hf_info.hf_cmd = HFMRES;
  107.         hf_info.loc_value1 = 8;
  108.         if (ioctl(hftQFD,HFCHGLOC,&hf_info)<0) perror("mouse ioctl resolution");
  109.  
  110.         hf_info.hf_cmd = HFMTHRESH;
  111.         hf_info.loc_value1 = 1;
  112.         hf_info.loc_value2 = 1;
  113.         if (ioctl(hftQFD,HFCHGLOC,&hf_info)<0) perror("mouse ioctl threshhold");
  114.  
  115.         hf_info.hf_cmd = HFMSCALE;
  116.         hf_info.loc_value1 = 1;
  117.         if (ioctl(hftQFD,HFCHGLOC,&hf_info)<0) perror("mouse ioctl scale");
  118.  
  119. #endif
  120.         break;
  121.     case DEVICE_ON:
  122.         pDev->on = TRUE;
  123.         break;
  124.     case DEVICE_OFF:
  125.         pDev->on = FALSE;
  126.         break;
  127.     case DEVICE_CLOSE:
  128.         break;
  129.     }
  130.     return Success;
  131. }
  132.