home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / AIX / aixCursor.c < prev    next >
C/C++ Source or Header  |  1991-09-20  |  3KB  |  118 lines

  1. /*
  2.  * $Id: aixCursor.c,v 1.1 1991/09/20 17:58:56 mtranle Exp $
  3.  *
  4.  * Copyright IBM Corporation 1987,1988,1989
  5.  *
  6.  * All Rights Reserved
  7.  *
  8.  * Permission 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 AND FITNESS, IN NO EVENT SHALL
  18.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22.  * SOFTWARE.
  23.  *
  24. */
  25.  
  26. #ifndef lint
  27. static char sccsid[] = "@(#)aixCursor.c    2.1 88/09/19 11:52:30";
  28. #endif
  29.  
  30. #include <stdio.h>
  31. #include <sys/types.h>
  32. #include <sys/file.h>
  33.  
  34. #define NEED_EVENTS
  35. #include "X.h"
  36. #include "Xproto.h"
  37. #include "input.h"
  38. #include "scrnintstr.h"
  39. #include "cursorstr.h"
  40. #include "miscstruct.h"
  41.  
  42. #include "OSio.h"
  43.  
  44. #include "ibmScreen.h"
  45. #include "ibmIO.h"
  46.  
  47. #include "aixCursor.h"
  48.  
  49. #include "ibmTrace.h"
  50.  
  51.  
  52. /***============================================================***/
  53.  
  54. void
  55. AIXConstrainCursor( pScr, pBox )
  56.      ScreenPtr      pScr ;
  57.      BoxPtr         pBox ;
  58. {
  59.  
  60.     TRACE( ( "AIXConstrainCursor(pScr=0x%x,pBox=0x%x)\n" ) ) ;
  61.     /* XXX -- not implemented yet */
  62.     return ;
  63. }
  64.  
  65.  
  66. /***============================================================***/
  67.  
  68. int
  69. AIXSetCursorPosition( pScr, x, y, generateEvent )
  70.      ScreenPtr     pScr;
  71.      int    x,y;
  72.      Bool    generateEvent;
  73. {
  74.     xEvent    motion;
  75.     DevicePtr    mouse;
  76.  
  77.     TRACE(("AIXSetCursorPosition( pScr= 0x%x, x= %d, y= %d )\n",pScr,x,y));
  78.     if (pScr->myNum!=ibmCurrentScreen)
  79.     {
  80.     if (ibmHideCursor(ibmCurrentScreen))
  81.         (*ibmHideCursor(ibmCurrentScreen))(ibmScreen(ibmCurrentScreen));
  82.     ibmCurrentScreen= pScr->myNum;
  83.     }
  84.  
  85.     if (generateEvent)
  86.     {
  87.     ProcessInputEvents();
  88.     motion.u.keyButtonPointer.rootX = x;
  89.     motion.u.keyButtonPointer.rootY = y;
  90.     motion.u.keyButtonPointer.time  = lastEventTime;
  91.     motion.u.u.type                 = MotionNotify;
  92.     mouse= LookupPointerDevice();
  93.     (*mouse->processInputProc)(&motion,mouse,1);
  94.     }
  95.     AIXCurrentX= x;
  96.     AIXCurrentY= y;
  97.     (*(ibmCursorShow(pScr->myNum)))(x,y);
  98.     return TRUE;
  99. }
  100.  
  101. /***============================================================***/
  102.  
  103. void
  104. AIXCursorLimits( pScr, pCurs, pHotBox, pTopLeftBox )
  105.      ScreenPtr    pScr;
  106.      CursorPtr    pCurs;
  107.      BoxPtr    pHotBox;
  108.      BoxPtr    pTopLeftBox;
  109. {
  110.     TRACE(("AIXCursorLimits( pScr= 0x%x, pCurs= 0x%x, pHotBox= 0x%x, pTopLeftBox= 0x%x)\n", pScr, pCurs, pHotBox, pTopLeftBox));
  111.  
  112.     pTopLeftBox->x1= max( pHotBox->x1, 0 );
  113.     pTopLeftBox->y1= max( pHotBox->y1, 0 );
  114.     pTopLeftBox->x2= min( pHotBox->x2, pScr->width );
  115.     pTopLeftBox->y2= min( pHotBox->y2, pScr->height );
  116.     return ;
  117. }
  118.