home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / mpel / mpelwin.c < prev    next >
C/C++ Source or Header  |  1989-11-09  |  6KB  |  279 lines

  1. /*
  2.  * Copyright IBM Corporation 1987,1988,1989
  3.  *
  4.  * All Rights Reserved
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted,
  8.  * provided that the above copyright notice appear in all copies and that 
  9.  * both that copyright notice and this permission notice appear in
  10.  * supporting documentation, and that the name of IBM not be
  11.  * used in advertising or publicity pertaining to distribution of the
  12.  * software without specific, written prior permission.
  13.  *
  14.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20.  * SOFTWARE.
  21.  *
  22. */
  23. #ifdef AIXEXTENSIONS
  24. #include "X.h"
  25. #include "Xmd.h"
  26. #include "scrnintstr.h"
  27. #include "windowstr.h"
  28. #include "mfb.h"
  29. #include "mistruct.h"
  30. #include "regionstr.h"
  31.  
  32. #include "OScompiler.h"
  33. #include "ibmTrace.h"
  34.  
  35.  
  36. extern void ppcCopyWindow();
  37.  
  38. #include "AIXext.h"
  39.  
  40. void mpelWIProc()
  41. {
  42. };
  43.  
  44. Bool
  45. mpelValidateWindow()
  46. {
  47. }
  48.  
  49. Bool
  50. mpelDestroyWindowHeader(pWin,pWI)
  51. WindowPtr pWin;
  52. WInterestPtr pWI;
  53. {
  54.     if (pWI)
  55.         xfree(pWI) ;
  56. }
  57.  
  58. Bool mpelChangeExtWindowAttributes(pWin,mask,pPrivate)
  59. register WindowPtr pWin;
  60. register int mask;
  61. register pointer pPrivate ; 
  62. {
  63.    aixPrivWin *pPrivWin;
  64.    WInterestPtr pWI , pWInit , pWInext ;
  65.    pPrivWin = (aixPrivWin *)(pWin->devPrivate) ;
  66.  
  67.    /* here we Map WindowInterest Stuff */
  68.    /* replace the following codes by macro ??? */
  69.  
  70.     pWI = pPrivWin->pNextWInterest;
  71.     pWInit = (WInterestPtr) &pPrivWin->pNextWInterest;
  72.  
  73.     do
  74.     {
  75.         pWInext = pWI->pNextWInterest;
  76.     if(pWI->ChangeExtWindowAttributes)
  77.         (*pWI->ChangeExtWindowAttributes) (pWin,mask,pPrivate);
  78.     pWI = pWInext;
  79.     }
  80.     while(pWI != pWInit);
  81.  
  82. }
  83.  
  84.  
  85. extern WindowRec WindowTable[];
  86.  
  87. Bool mpelCreateWindow(pWin)
  88. register WindowPtr pWin;
  89. {
  90.     register aixPrivWin *pPrivWin;
  91.  
  92.     WInterestPtr pWI;
  93.  
  94.     TRACE(("mpelCreateWindow( pWin= 0x%x )\n",pWin));
  95.  
  96.     pWin->ClearToBackground = miClearToBackground;
  97.     pWin->PaintWindowBackground = mfbPaintWindowNone;
  98.     pWin->PaintWindowBorder = mfbPaintWindowPR;
  99.     pWin->CopyWindow = ppcCopyWindow;
  100.  
  101.     if(!(pPrivWin = (aixPrivWin *)Xalloc(sizeof(aixPrivWin))))
  102.      return (FALSE);
  103.  
  104.     pWin->devPrivate = (pointer)pPrivWin;
  105.     pPrivWin->pRotatedBorder = NullPixmap;
  106.     pPrivWin->pRotatedBackground = NullPixmap;
  107.     pPrivWin->fastBackground = 0;
  108.     pPrivWin->fastBorder = 0;
  109.  
  110.  
  111.     /* here we initialize WindowInterest Stuff */
  112.     /* create the head of WindowInterest */
  113.  
  114.     if (! (pWI = (WInterestPtr) xalloc(sizeof(WInterestRec))) ) {
  115.     xfree(pPrivWin);
  116.     return FALSE;
  117.     }
  118.      
  119.     /*
  120.      * Now link this into the WIqueue
  121.      */
  122.  
  123.     pPrivWin->pNextWInterest = pWI;
  124.     pPrivWin->pLastWInterest = pWI;
  125.  
  126.     pWI->pNextWInterest = (WInterestPtr) &pPrivWin->pNextWInterest;
  127.     pWI->pLastWInterest = (WInterestPtr) &pPrivWin->pNextWInterest;
  128.     pWI->length = sizeof(WInterestRec); 
  129.     pWI->owner = 0;        /* server owns this */
  130.     pWI->ValInterestMask = ~0;    /* interested in everything at validate time */
  131.     pWI->ValidateWindow = mpelValidateWindow ;
  132.     pWI->ChangeInterestMask = 0; /* interested in nothing at change time */
  133.     pWI->ChangeExtWindowAttributes = (Bool (*)()) NULL ;
  134.     pWI->MapWindow = (Bool (*)()) NULL ;
  135.     pWI->UnmapWindow = (Bool (*)()) NULL ;
  136.     pWI->CreateWindow = (Bool (*)()) NULL ;
  137.     pWI->DestroyWindow = mpelDestroyWindowHeader ;
  138.     pWI->PositionWindow = (Bool (*)()) NULL ;
  139.     pWI->WIProc = mpelWIProc ;
  140.     pWI->extPriv = 0 ;
  141.  
  142.  
  143.     return (TRUE);
  144. }
  145.  
  146.  
  147. Bool 
  148. mpelDestroyWindow(pWin)
  149.     WindowPtr pWin;
  150. {
  151.  
  152.     aixPrivWin *pPrivWin;
  153.  
  154.     WInterestPtr pWI , pWInit , pWInext ;
  155.  
  156.     pPrivWin = (aixPrivWin *)(pWin->devPrivate);
  157.  
  158.  
  159.    /* here we Destroy WindowInterest Stuff */
  160.  
  161.     pWI = pPrivWin->pNextWInterest;
  162.     pWInit = (WInterestPtr) &pPrivWin->pNextWInterest;
  163.  
  164.     do
  165.     {
  166.         pWInext = pWI->pNextWInterest;
  167.     if(pWI->DestroyWindow)
  168.         (*pWI->DestroyWindow) (pWin, pWI);
  169.     pWI = pWInext;
  170.     }
  171.     while(pWI != pWInit);
  172.  
  173.  
  174.     /* keep it for a while  ! */
  175.  
  176.     if(pPrivWin->pRotatedBorder)
  177.         mfbDestroyPixmap(pPrivWin->pRotatedBorder);
  178.  
  179.     if(pPrivWin->pRotatedBackground)
  180.         mfbDestroyPixmap(pPrivWin->pRotatedBackground);
  181.  
  182.     Xfree(pWin->devPrivate);
  183.  
  184.     return (TRUE);
  185. }
  186.  
  187.  
  188. Bool mpelMapWindow(pWin)
  189. WindowPtr pWin;
  190. {
  191.  
  192.    aixPrivWin *pPrivWin;
  193.    WInterestPtr pWI , pWInit , pWInext ;
  194.    pPrivWin = (aixPrivWin *)(pWin->devPrivate);
  195.  
  196.    /* here we Map WindowInterest Stuff */
  197.    /* replace the following codes by macro ??? */
  198.  
  199.     pWI = pPrivWin->pNextWInterest;
  200.     pWInit = (WInterestPtr) &pPrivWin->pNextWInterest;
  201.  
  202.     do
  203.     {
  204.         pWInext = pWI->pNextWInterest;
  205.     if(pWI->MapWindow)
  206.         (*pWI->MapWindow) (pWin);
  207.     pWI = pWInext;
  208.     }
  209.     while(pWI != pWInit);
  210.  
  211.  
  212.     mfbMapWindow(pWin) ;
  213.  
  214.     return (TRUE);
  215. }
  216.  
  217.  
  218. Bool mpelPositionWindow(pWin, x, y)
  219. register WindowPtr pWin;
  220. int x, y;
  221. {
  222.  
  223.    register aixPrivWin *pPrivWin;
  224.    WInterestPtr pWI , pWInit , pWInext ;
  225.  
  226.    pPrivWin = (aixPrivWin *)(pWin->devPrivate);
  227.  
  228.    /* here we Position WindowInterest Stuff */
  229.    /* replace the following codes by macro ??? */
  230.  
  231.     pWI = pPrivWin->pNextWInterest;
  232.     pWInit = (WInterestPtr) &pPrivWin->pNextWInterest;
  233.  
  234.     do
  235.     {
  236.         pWInext = pWI->pNextWInterest;
  237.     if(pWI->PositionWindow)
  238.         (*pWI->PositionWindow) (pWin,x,y);
  239.     pWI = pWInext;
  240.     }
  241.     while(pWI != pWInit);
  242.  
  243.     mfbPositionWindow(pWin,x,y);    
  244.  
  245.     return (TRUE);
  246. }
  247.  
  248. Bool mpelUnmapWindow(pWin, x, y)
  249. WindowPtr pWin;
  250. int x, y;
  251. {
  252.  
  253.  
  254.    aixPrivWin *pPrivWin;
  255.    WInterestPtr pWI , pWInit , pWInext ;
  256.    pPrivWin = (aixPrivWin *)(pWin->devPrivate);
  257.  
  258.    /* here we Map WindowInterest Stuff */
  259.    /* replace the following codes by macro ??? */
  260.  
  261.     pWI = pPrivWin->pNextWInterest;
  262.     pWInit = (WInterestPtr) &pPrivWin->pNextWInterest;
  263.  
  264.     do
  265.     {
  266.         pWInext = pWI->pNextWInterest;
  267.     if(pWI->UnmapWindow)
  268.         (*pWI->UnmapWindow) (pWin,x,y);
  269.     pWI = pWInext;
  270.     }
  271.     while(pWI != pWInit);
  272.  
  273.  
  274.     mfbUnmapWindow(pWin, x, y) ;
  275.  
  276.     return (TRUE);
  277. }
  278. #endif
  279.