home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / apa16 / apa16Win.c < prev    next >
C/C++ Source or Header  |  1991-12-30  |  7KB  |  200 lines

  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. /***********************************************************
  25.         Copyright IBM Corporation 1987,1988
  26.  
  27.                       All Rights Reserved
  28.  
  29. Permission to use, copy, modify, and distribute this software and its 
  30. documentation for any purpose and without fee is hereby granted, 
  31. provided that the above copyright notice appear in all copies and that
  32. both that copyright notice and this permission notice appear in 
  33. supporting documentation, and that the name of IBM not be
  34. used in advertising or publicity pertaining to distribution of the
  35. software without specific, written prior permission.  
  36.  
  37. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  38. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  39. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  40. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  41. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  42. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  43. SOFTWARE.
  44.  
  45. ******************************************************************/
  46. /***********************************************************
  47. Copyright 1989 by the Massachusetts Institute of Technology
  48.  
  49.                      All rights reserved.
  50.  
  51. Permission to use, copy, modify, and distribute this software and its
  52. documentation for any purpose and without fee is hereby granted,
  53. provided that the above copyright notice appear in all copies and that
  54. both that copyright notice and this permission notice appear in
  55. supporting documentation, and that the name of the Massachusetts
  56. Institute of Technology (M.I.T.) not be used in advertising or publicity
  57. pertaining to distribution of the software without specific, written
  58. prior permission.
  59.  
  60. M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  61. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  62. M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  63. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  64. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  65. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  66. SOFTWARE.
  67.  
  68. ******************************************************************/
  69.  
  70. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16Win.c,v 5.0 1991/12/30 19:27:05 jfc Exp $ */
  71. /* $Source: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16Win.c,v $ */
  72.  
  73. #ifndef lint
  74. static char *rcsid = "$Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16Win.c,v 5.0 1991/12/30 19:27:05 jfc Exp $";
  75. #endif
  76.  
  77.  
  78. #include "X.h"
  79. #include "Xmd.h"
  80. #include "scrnintstr.h"
  81. #include "windowstr.h"
  82. #include "mfb.h"
  83. #include "mistruct.h"
  84. #include "regionstr.h"
  85.  
  86. #include "maskbits.h"    /* for Duff macro */
  87.  
  88. #include "OScompiler.h"
  89. #include "ibmTrace.h"
  90. #include "apa16Hdwr.h"
  91.  
  92. extern WindowPtr *WindowTable;
  93.  
  94. extern int *apa16CurrentTileBits;    /* used for invalidating scratch area */
  95.  
  96. /* UNCLEAN!
  97.    this code calls the bitblt helper code directly.
  98.  
  99.    mfbCopyWindow copies only the parts of the destination that are
  100. visible in the source.
  101. */
  102.  
  103.  
  104. void 
  105. apa16CopyWindow(pWin, ptOldOrg, prgnSrc)
  106.     WindowPtr pWin;
  107.     DDXPointRec ptOldOrg;
  108.     RegionPtr prgnSrc;
  109. {
  110.     DDXPointPtr pptSrc;
  111.     register DDXPointPtr ppt;
  112.     RegionPtr prgnDst;
  113.     register BoxPtr pbox;
  114.     register int dx, dy;
  115.     register int i, nbox;
  116.     WindowPtr pwinRoot;
  117.  
  118.     TRACE(("apa16CopyWindow(pWin= 0x%x, ptOldOrg= 0x%x, prgnSrc= 0x%x)\n",
  119.                             pWin,ptOldOrg,prgnSrc));
  120.  
  121.     pwinRoot = WindowTable[pWin->drawable.pScreen->myNum];
  122.  
  123.     prgnDst = (* pWin->drawable.pScreen->RegionCreate)(NULL, 1);
  124.  
  125.     dx = ptOldOrg.x - pWin->drawable.x;
  126.     dy = ptOldOrg.y - pWin->drawable.y;
  127.     (* pWin->drawable.pScreen->TranslateRegion)(prgnSrc, -dx, -dy);
  128.     (* pWin->drawable.pScreen->Intersect)(prgnDst, &pWin->borderClip, prgnSrc);
  129.  
  130.     pbox = REGION_RECTS(prgnDst);
  131.     nbox = REGION_NUM_RECTS(prgnDst);
  132.     if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec))))
  133.     return;
  134.     ppt = pptSrc;
  135.  
  136.     i = nbox;
  137.     Duff(i, ppt->x = pbox->x1 + dx; ppt->y = pbox->y1 + dy; ppt++; pbox++);
  138.  
  139.     apa16DoBitblt(pwinRoot, pwinRoot, GXcopy, prgnDst, pptSrc);
  140.     DEALLOCATE_LOCAL(pptSrc);
  141.     (* pWin->drawable.pScreen->RegionDestroy)(prgnDst);
  142. }
  143.  
  144. /***====================================================================***/
  145. void
  146. apa16PaintWindow32(pWin, pRegion, what)
  147. WindowPtr pWin;
  148. RegionPtr pRegion;
  149. int what;
  150. {
  151.     int        nbox;
  152.     BoxPtr        pBox;
  153.     PixmapPtr    pPix;
  154.     mfbPrivWin     *pPrivWin;
  155.  
  156.     TRACE(("apa16PaintWindow32(0x%x,0x%x,0x%x)\n",pWin,pRegion,what));
  157.  
  158.     pPrivWin = (mfbPrivWin *) (pWin->devPrivates[mfbWindowPrivateIndex].ptr);
  159.     if (what==PW_BACKGROUND)
  160.     pPix= pPrivWin->pRotatedBackground;
  161.     else
  162.     pPix= pPrivWin->pRotatedBorder;
  163.     if (!pPix)
  164.         miPaintWindow(pWin, pRegion, what);
  165.  
  166.     nbox= REGION_NUM_RECTS(pRegion);
  167.     pBox= REGION_RECTS(pRegion);
  168.  
  169.     /* XXX */
  170.     /* Should already be handled below XXX */
  171.     apa16CurrentTileBits = NULL;    /* invalidate apa scratch area */
  172.     /* XXX */
  173.  
  174.     while (nbox--) {
  175.     apa16TileArea32(pWin, 1, pBox, GXcopy, pPix);
  176.     pBox++;
  177.     }
  178.     return;
  179. }
  180. /***====================================================================***/
  181.  
  182. Bool
  183. apa16ChangeWindowAttributes(pWin, mask)
  184.     WindowPtr pWin;
  185.     int mask;
  186. {
  187. mfbPrivWin    *pPrivWin;
  188.  
  189.     TRACE(("apa16ChangeWindowAttributes( pWin= 0x%x, mask= 0x%x )\n",
  190.                                 pWin,mask));
  191.  
  192.     pPrivWin = (mfbPrivWin *)(pWin->devPrivates[mfbWindowPrivateIndex].ptr);
  193.  
  194.     if ((mask)&&(mfbChangeWindowAttributes(pWin,mask))) {
  195.     return(TRUE);
  196.     }
  197.     return(FALSE);
  198. }
  199.  
  200.