home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_10 / 9n10105a < prev    next >
Text File  |  1991-07-24  |  832b  |  48 lines

  1.  
  2.     #define WIDTH     400
  3.     #define HEIGHT    300
  4.     #define MAX_RECTS    100
  5.  
  6.     XRectangle    rectangles[ MAX_RECTS + 1 ];
  7.     Display        *display;
  8.     Window        window;
  9.     int            number_rectangles, i;
  10.  
  11.     /*
  12.      * Set up some rectangles
  13.      */
  14.     i = 0;
  15.     for ( x = 0; x < WIDTH; x += 50 )
  16.              {
  17.              for( y = 0; y < HEIGHT; y += 50 )
  18.             {
  19.             i++;
  20.  
  21.             if ( i >= MAX_RECTS )
  22.                 {
  23.                 i = MAX_RECTS - 1;
  24.                 }
  25.  
  26.             rectangles[i].width  = 45;
  27.             rectangles[i].height = 45;
  28.  
  29.             rectangles[i].x = x;
  30.             rectangles[i].y = y;
  31.             }
  32.         }
  33.  
  34.  
  35.     /*
  36.      * Make our window's shape be the set of rectangles
  37.      */
  38.     number_rectangles = i;
  39.     XShapeCombineRectangles( display, 
  40.         window,
  41.         ShapeBounding,
  42.         0, 0,         /* x, y, offsets */
  43.         rectangles,
  44.         number_rectangles,
  45.         ShapeSet,
  46.         Unsorted );  /* we haven't sorted the rects */
  47.  
  48.