home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / ddx / ibm / skyway / skyIO.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-21  |  5.0 KB  |  165 lines

  1. /*
  2.  * $XConsortium: skyIO.c,v 1.6 91/09/09 13:21:26 rws 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. /*
  28.  * skyIO.c - initialize display, cfb, cursor, etc.
  29.  */
  30.  
  31. #include <sys/hft.h>
  32. #include "X.h"
  33. #include "screenint.h"
  34. #include "scrnintstr.h"
  35. #include "cursorstr.h"
  36. #include "pixmapstr.h"
  37. #include "miscstruct.h"
  38. #include "colormap.h"
  39. #include "colormapst.h"
  40. #include "resource.h"
  41.  
  42. #include "ibmScreen.h"
  43. #include "OSio.h"
  44. #include "ibmTrace.h"
  45.  
  46. #include "aixCursor.h"
  47.  
  48. #include "mipointer.h"
  49. #include "misprite.h"
  50. #include "gcstruct.h"
  51.  
  52. #include "skyHdwr.h"
  53. #include "skyProcs.h"
  54.  
  55. #include <pgc/pgc.h>
  56. #include <pgc/pgcProcs.h>
  57.  
  58. extern miPointerScreenFuncRec skyPointerScreenFuncs;
  59. extern pointer pSkywayFrame;
  60. extern pgcScreenRec pgcScreenInfo[] ;
  61.  
  62. extern Bool skyRealizeCursor();
  63. extern Bool skyUnrealizeCursor();
  64. extern Bool skyDisplayCursor();
  65. extern void miRecolorCursor();
  66.  
  67. extern void skyValidateGC();
  68. extern void cfbChangeGC(), cfbCopyGC(), cfbDestroyGC();
  69. extern void cfbChangeClip(), cfbDestroyClip(), cfbCopyClip();
  70. /*
  71.  * By overloading the definition of the cfbGCFuncs struct with the
  72.  * skyway ValidateGC proc, which adds the fast CopyArea func into
  73.  * GC's with depth 8, we can do the hardware bitblt rather than the
  74.  * slower software cfbCopyArea.
  75.  *
  76.  * It works, but keep in mind it depends on the libibm.a getting
  77.  * linked ahead of the cfb routines!
  78.  *
  79.  * This is perhaps not the best way to do this , but the sample server has
  80.  * no good way of adding new procs into GCs because the backingstore
  81.  * routines put the cfb procs into a private area.
  82.  */
  83. GCFuncs cfbGCFuncs = {
  84.     skyValidateGC,
  85.     cfbChangeGC,
  86.     cfbCopyGC,
  87.     cfbDestroyGC,
  88.     cfbChangeClip,
  89.     cfbDestroyClip,
  90.     cfbCopyClip,
  91. };
  92. Bool
  93. skyScreenIO(index, pScreen, argc, argv)
  94.     register int        index;
  95.     register ScreenPtr  pScreen;
  96.     int         argc;           /* these two may NOT be changed */
  97.     char        **argv;
  98. {
  99.     ColormapPtr pColormap;
  100.     Bool        retval;
  101.     int         i;
  102.     pgcScreenPtr pPGCScreen ;
  103.  
  104.     TRACE(("skyIO(%d,0x%x,%d,0x%x)\n",index,pScreen,argc,argv));
  105.  
  106.     /* Get pointer to the adapter structure. Everthing else can be      */
  107.     /* pointed to from this structure.                                  */
  108.  
  109.     skyScreenInit(index);
  110.     skyHdwrInit(index);
  111.  
  112.     pPGCScreen = &pgcScreenInfo[index] ;
  113.  
  114.     pPGCScreen->blit = SkywayBitBlt ;
  115.     pPGCScreen->solidFill = SkywayFillSolid ;
  116.     pPGCScreen->tileFill = SkywayTileRect ;
  117.     pPGCScreen->setColor = skySetColor ;
  118.     pPGCScreen->imageFill = skywayDrawColorImage ;
  119.     pPGCScreen->imageRead = skywayReadColorImage ;
  120.  
  121.     pScreen->RealizeCursor=     skyRealizeCursor;
  122.     pScreen->UnrealizeCursor=   skyUnrealizeCursor;
  123.     pScreen->DisplayCursor=     skyDisplayCursor;
  124.     pScreen->RecolorCursor=     miRecolorCursor;
  125.  
  126.     pScreen->SetCursorPosition= AIXSetCursorPosition;
  127.     pScreen->CursorLimits=      AIXCursorLimits;
  128.     pScreen->PointerNonInterestBox= AIXPointerNonInterestBox;
  129.     pScreen->ConstrainCursor=   AIXConstrainCursor;
  130.  
  131.     pScreen->QueryBestSize = skyQueryBestSize;
  132.  
  133.     pScreen->InstallColormap = skyInstallColormap;
  134.     pScreen->UninstallColormap = skyUninstallColormap;
  135.     pScreen->ListInstalledColormaps = skyListInstalledColormaps;
  136.     pScreen->StoreColors = skyStoreColors;
  137.  
  138.     if ( !cfbScreenInit(pScreen, pSkywayFrame, SKYWAY_WIDTH, SKYWAY_HEIGHT,
  139.                     92, 92, SKYWAY_WIDTH) )
  140.     {
  141.     TRACE (("skyIO: cfbScreenInit failed\n"));
  142.     return FALSE;
  143.     }
  144.  
  145.     pScreen->PaintWindowBorder        = pgcPaintWindow ;
  146.     pScreen->CopyWindow        = pgcCopyWindow ;
  147.     pScreen->PaintWindowBackground = pgcPaintWindow ;
  148.  
  149.     pScreen->CloseScreen   = skyScreenClose;
  150.     pScreen->SaveScreen    = ibmSaveScreen;
  151.     pScreen->BlockHandler  = AIXBlockHandler;
  152.     pScreen->WakeupHandler = AIXWakeupHandler;
  153.     pScreen->blockData     = (pointer)0;
  154.     pScreen->wakeupData    = (pointer)0;
  155.  
  156.     if ( !cfbCreateDefColormap (pScreen) )
  157.     {
  158.     TRACE (("skyIO: cfbCreateDefColormap failed\n"));
  159.     return FALSE;
  160.     }
  161.  
  162.     ibmScreen(index) = pScreen;
  163.     return TRUE ;
  164. }
  165.