home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / x / x11p-13.zip / RCS / do_windows.c,v < prev    next >
Text File  |  1989-12-07  |  16KB  |  883 lines

  1. head     2.6;
  2. access   ;
  3. symbols  pre-merge:2.0;
  4. locks    ; strict;
  5. comment  @ * @;
  6.  
  7.  
  8. 2.6
  9. date     89.12.07.16.37.17;  author joel;  state Exp;
  10. branches ;
  11. next     2.5;
  12.  
  13. 2.5
  14. date     89.10.02.14.48.10;  author joel;  state Exp;
  15. branches ;
  16. next     2.4;
  17.  
  18. 2.4
  19. date     89.05.16.11.42.56;  author joel;  state Exp;
  20. branches ;
  21. next     2.3;
  22.  
  23. 2.3
  24. date     89.05.11.16.45.17;  author joel;  state Exp;
  25. branches ;
  26. next     2.2;
  27.  
  28. 2.2
  29. date     89.05.09.13.01.13;  author joel;  state Exp;
  30. branches ;
  31. next     2.1;
  32.  
  33. 2.1
  34. date     89.05.03.14.18.25;  author joel;  state Exp;
  35. branches ;
  36. next     2.0;
  37.  
  38. 2.0
  39. date     89.01.31.17.06.42;  author erik;  state Exp;
  40. branches ;
  41. next     1.2;
  42.  
  43. 1.2
  44. date     89.01.31.17.06.42;  author joel;  state Exp;
  45. branches ;
  46. next     1.1;
  47.  
  48. 1.1
  49. date     88.06.20.22.02.33;  author joel;  state Exp;
  50. branches ;
  51. next     ;
  52.  
  53.  
  54. desc
  55. @@
  56.  
  57.  
  58. 2.6
  59. log
  60. @Changed interface to p->reps
  61. @
  62. text
  63. @/*****************************************************************************
  64. Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
  65.  
  66.                         All Rights Reserved
  67.  
  68. Permission to use, copy, modify, and distribute this software and its 
  69. documentation for any purpose and without fee is hereby granted, 
  70. provided that the above copyright notice appear in all copies and that
  71. both that copyright notice and this permission notice appear in 
  72. supporting documentation, and that the name of Digital not be
  73. used in advertising or publicity pertaining to distribution of the
  74. software without specific, written prior permission.  
  75.  
  76. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  77. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  78. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  79. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  80. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  81. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  82. SOFTWARE.
  83.  
  84. ******************************************************************************/
  85.  
  86. #include "x11perf.h"
  87.  
  88. static Window *parents;
  89. static Window *isolates;
  90. static int childrows, childcolumns, childwindows;
  91. static int parentrows, parentcolumns, parentwindows;
  92. static int parentwidth, parentheight;
  93. static Window popup;
  94.  
  95. void ComputeSizes(xp, p)
  96.     XParms  xp;
  97.     Parms   p;
  98. {
  99.     childwindows = p->objects;
  100.     childrows = (childwindows + MAXCOLS - 1) / MAXCOLS;
  101.     childcolumns = (childrows > 1 ? MAXCOLS : childwindows);
  102.  
  103.     parentwidth = (CHILDSIZE+CHILDSPACE) * childcolumns;
  104.     parentheight = (CHILDSIZE+CHILDSPACE) * childrows;
  105. }
  106.  
  107. int CreateParents(xp, p, reps)
  108.     XParms  xp;
  109.     Parms   p;
  110.     int     reps;
  111. {
  112.     int     i;
  113.  
  114.     ComputeSizes(xp, p);
  115.  
  116.     parentcolumns = WIDTH / parentwidth;
  117.     parentrows = HEIGHT / parentheight;
  118.     parentwindows = parentcolumns * parentrows; /* Max reps we can fit */
  119.  
  120.     if (parentwindows > reps) {
  121.     parentwindows = reps;
  122.     }
  123.  
  124.     /* We will do parentwindows sets of childwindows, in order to get better
  125.        timing accuracy.  Creating 4 windows at a millisecond apiece or so
  126.        is a bit faster than the 60 Hz clock. */
  127.     isolates = (Window *)malloc(parentwindows * sizeof(Window));
  128.     parents = (Window *)malloc(parentwindows * sizeof(Window));
  129.  
  130.     /*
  131.      *  Create isolation windows for the parents, and then the parents
  132.      *  themselves.  These isolation windows ensure that parent and children
  133.      *  windows created/mapped in DoWins and DoWin2 all see the same local
  134.      *  environment...the parent is an only child, and each parent contains
  135.      *  the number of children we are trying to get benchmarks on.
  136.      */
  137.  
  138.     for (i = 0; i != parentwindows; i++) {
  139.     isolates[i] = XCreateSimpleWindow(xp->d, xp->w,
  140.         (i/parentrows)*parentwidth, (i%parentrows)*parentheight,
  141.         parentwidth, parentheight, 0, xp->background, xp->background);
  142.     parents[i] = XCreateSimpleWindow(xp->d, isolates[i],
  143.         0, 0, parentwidth, parentheight, 0, xp->background, xp->background);
  144.     }
  145.  
  146.     XMapSubwindows(xp->d, xp->w);
  147.     return parentwindows;
  148. } /* CreateParents */
  149.  
  150.  
  151. void MapParents(xp, p, reps)
  152.     XParms  xp;
  153.     Parms   p;
  154.     int     reps;
  155. {
  156.     int i;
  157.  
  158.     for (i = 0; i != parentwindows; i++) {
  159.     XMapWindow(xp->d, parents[i]);
  160.     }
  161. }
  162.  
  163.  
  164. int InitCreate(xp, p, reps)
  165.     XParms  xp;
  166.     Parms   p;
  167.     int     reps;
  168. {
  169.     reps = CreateParents(xp, p, reps);
  170.     MapParents(xp, p, reps);
  171.     return reps;
  172. }
  173.  
  174. void CreateChildGroup(xp, p, parent)
  175.     XParms  xp;
  176.     Parms   p;
  177.     Window  parent;
  178. {
  179.     int j;
  180.  
  181.     for (j = 0; j != childwindows; j++) {
  182.     (void) XCreateSimpleWindow (xp->d, parent,
  183.         (CHILDSIZE+CHILDSPACE) * (j/childrows) + CHILDSPACE/2,
  184.         (CHILDSIZE+CHILDSPACE) * (j%childrows) + CHILDSPACE/2,
  185.         CHILDSIZE, CHILDSIZE, 0, xp->background, xp->foreground);
  186.     }
  187.  
  188.     if (p->special)
  189.     XMapSubwindows (xp->d, parent);
  190. }
  191.  
  192. void CreateChildren(xp, p, reps)
  193.     XParms  xp;
  194.     Parms   p;
  195.     int     reps;
  196. {
  197.     int     i;
  198.  
  199.     for (i = 0; i != parentwindows; i++) {
  200.     CreateChildGroup(xp, p, parents[i]);
  201.     } /* end i */
  202. }
  203.  
  204. void DestroyChildren(xp, p, reps)
  205.     XParms  xp;
  206.     Parms   p;
  207.     int     reps;
  208. {
  209.     int i;
  210.  
  211.     for (i = 0; i != parentwindows; i++) {
  212.     XDestroySubwindows(xp->d, parents[i]);
  213.     }
  214. }
  215.  
  216. void EndCreate(xp, p)
  217.     XParms  xp;
  218.     Parms   p;
  219. {
  220.     XDestroySubwindows(xp->d, xp->w);
  221.     free(parents);
  222.     free(isolates);
  223. }
  224.  
  225.  
  226. int InitMap(xp, p, reps)
  227.     XParms  xp;
  228.     Parms   p;
  229.     int     reps;
  230. {
  231.     int i;
  232.  
  233.     reps = CreateParents(xp, p, reps);
  234.     CreateChildren(xp, p, reps);
  235.     return reps;
  236. }
  237.  
  238. void UnmapParents(xp, p, reps)
  239.     XParms  xp;
  240.     Parms   p;
  241.     int     reps;
  242. {
  243.     int i;
  244.  
  245.     for (i = 0; i != parentwindows; i++) {
  246.     XUnmapWindow(xp->d, parents[i]);
  247.     }
  248. }
  249.  
  250. int InitDestroy(xp, p, reps)
  251.     XParms  xp;
  252.     Parms   p;
  253.     int     reps;
  254. {
  255.     reps = CreateParents(xp, p, reps);
  256.     CreateChildren(xp, p, reps);
  257.     MapParents(xp, p, reps);
  258.     return reps;
  259. }
  260.  
  261. void DestroyParents(xp, p, reps)
  262.     XParms  xp;
  263.     Parms   p;
  264.     int     reps;
  265. {
  266.     int i;
  267.  
  268.     for (i = 0; i != parentwindows; i++) {
  269.     XDestroyWindow(xp->d, parents[i]);
  270.     }
  271. }
  272.  
  273.  
  274. void RenewParents(xp, p)
  275.     XParms  xp;
  276.     Parms   p;
  277. {
  278.     int i;
  279.  
  280.     for (i = 0; i != parentwindows; i++) {
  281.     parents[i] = XCreateSimpleWindow(xp->d, isolates[i],
  282.         0, 0, parentwidth, parentheight, 0, xp->background, xp->background);
  283.     }
  284.     CreateChildren(xp, p, parentwindows);
  285.     MapParents(xp, p, parentwindows);
  286. }
  287.  
  288. int InitPopups(xp, p, reps)
  289.     XParms  xp;
  290.     Parms   p;
  291.     int     reps;
  292. {
  293.     XWindowAttributes    xwa;
  294.     XSetWindowAttributes xswa;
  295.     Window isolate;
  296.  
  297. #ifdef CHILDROOT
  298.     ComputeSizes(xp, p);
  299.     CreateChildGroup(xp, p, xp->w);
  300.  
  301.     /* Now create simple window to pop up over children */
  302.     (void) XGetWindowAttributes(xp->d, xp->w, &xwa);
  303.     xswa.override_redirect = True;
  304.     popup =  XCreateSimpleWindow (
  305.         xp->d, DefaultRootWindow(xp->d), 
  306.         xwa.x + xwa.border_width, xwa.y + xwa.border_width,
  307.         parentwidth, parentheight,
  308.         0, xp->foreground, xp->foreground);
  309. #else   
  310.     isolate = XCreateSimpleWindow(
  311.         xp->d, xp->w, 0, 0, WIDTH, HEIGHT,
  312.         0, xp->background, xp->background);
  313.  
  314.     ComputeSizes(xp, p);
  315.     CreateChildGroup(xp, p, isolate);
  316.     XMapWindow(xp->d, isolate);
  317.  
  318.     /* Now create simple window to pop up over children */
  319.     xswa.override_redirect = True;
  320.     popup =  XCreateSimpleWindow (
  321.         xp->d, xp->w, 0, 0,
  322.         parentwidth, parentheight,
  323.         0, xp->foreground, xp->foreground);
  324. #endif
  325.     XChangeWindowAttributes (xp->d, popup, CWOverrideRedirect, &xswa);
  326.     return reps;
  327. }
  328.  
  329. void DoPopUps(xp, p, reps)
  330.     XParms  xp;
  331.     Parms   p;
  332.     int     reps;
  333. {
  334.     int i;
  335.     for (i = 0; i != reps; i++) {
  336.         XMapWindow(xp->d, popup);
  337.     XUnmapWindow(xp->d, popup);
  338.     }
  339. }
  340.  
  341. void EndPopups(xp, p)
  342.     XParms  xp;
  343.     Parms p;
  344. {
  345.     XDestroySubwindows(xp->d, xp->w);
  346. #ifdef CHILDROOT
  347.     XDestroyWindow(xp->d, popup);
  348. #endif
  349. }
  350.  
  351. @
  352.  
  353.  
  354. 2.5
  355. log
  356. @Isolated popup window from rest of root-level windows.
  357. This caused timings to be much better in some cases....what I really need
  358. to do is figure out a test that causes the much lower numbers I was getting
  359. @
  360. text
  361. @d45 1
  362. a45 1
  363. void CreateParents(xp, p)
  364. d48 1
  365. d58 2
  366. a59 4
  367.     if (parentwindows > p->reps) {
  368.     parentwindows = p->reps;
  369.     } else {
  370.     p->reps = parentwindows;
  371. d85 1
  372. d89 1
  373. a89 1
  374. void MapParents(xp, p)
  375. d92 1
  376. d102 1
  377. a102 1
  378. Bool InitCreate(xp, p)
  379. d105 1
  380. d107 3
  381. a109 3
  382.     CreateParents(xp, p);
  383.     MapParents(xp, p);
  384.     return True;
  385. d130 1
  386. a130 1
  387. void CreateChildren(xp, p)
  388. d133 1
  389. d142 1
  390. a142 1
  391. void DestroyChildren(xp, p)
  392. d145 1
  393. d164 1
  394. a164 1
  395. Bool InitMap(xp, p)
  396. d167 1
  397. d171 3
  398. a173 3
  399.     CreateParents(xp, p);
  400.     CreateChildren(xp, p);
  401.     return True;
  402. d176 1
  403. a176 1
  404. void UnmapParents(xp, p)
  405. d179 1
  406. d188 1
  407. a188 1
  408. Bool InitDestroy(xp, p)
  409. d191 1
  410. d193 4
  411. a196 4
  412.     CreateParents(xp, p);
  413.     CreateChildren(xp, p);
  414.     MapParents(xp, p);
  415.     return True;
  416. d199 1
  417. a199 1
  418. void DestroyParents(xp, p)
  419. d202 1
  420. d222 2
  421. a223 2
  422.     CreateChildren(xp, p);
  423.     MapParents(xp, p);
  424. d226 1
  425. a226 1
  426. Bool InitPopups(xp, p)
  427. d229 1
  428. d264 1
  429. a264 1
  430.     return True;
  431. d267 1
  432. a267 1
  433. void DoPopUps(xp, p)
  434. d270 1
  435. d273 1
  436. a273 1
  437.     for (i = 0; i != p->reps; i++) {
  438. @
  439.  
  440.  
  441. 2.4
  442. log
  443. @Checked out to find mysterious timing problem.  Ended up being a lot of
  444. calls to XYToWindow in a field of a lot of windows.
  445. @
  446. text
  447. @d224 1
  448. d226 1
  449. d234 1
  450. a234 1
  451.         xp->d, RootWindow(xp->d, 0), 
  452. d237 17
  453. a253 1
  454.         0, xp->foreground, xp->background);
  455. d274 1
  456. d276 1
  457. @
  458.  
  459.  
  460. 2.3
  461. log
  462. @Parameters to all routines now (xp, p)
  463. MAXROWS used in all routines
  464. Junked most global communication variables
  465. @
  466. text
  467. @d56 1
  468. @
  469.  
  470.  
  471. 2.2
  472. log
  473. @Can do only as many reps as specified in p->reps, rather than always
  474. doing maximum amount.
  475. @
  476. text
  477. @d1 23
  478. d27 1
  479. a30 1
  480. static Window w;
  481. d33 3
  482. a35 3
  483. void ComputeSizes(d, p)
  484.     Display *d;
  485.     Parms p;
  486. d38 3
  487. a40 7
  488.     if (childwindows < 50) {
  489.     childcolumns = childwindows;
  490.     childrows = 1;
  491.     } else {
  492.     childcolumns = COLS;
  493.     childrows = (childwindows + COLS - 1) / COLS;
  494.     }
  495. d45 3
  496. a47 3
  497. void CreateParents(d, p)
  498.     Display *d;
  499.     Parms p;
  500. d49 1
  501. a49 2
  502.     Window isolate;
  503.     int i;
  504. d51 1
  505. a51 1
  506.     ComputeSizes(d, p);
  507. d65 1
  508. a67 2
  509.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, NULL, NULL);
  510.  
  511. d76 2
  512. a77 2
  513.     for (i = 0; i < parentwindows; i++) {
  514.     isolate = XCreateSimpleWindow(d, w,
  515. d79 3
  516. a81 3
  517.         parentwidth, parentheight, 0, bgPixel, bgPixel);
  518.     parents[i] = XCreateSimpleWindow(d, isolate,
  519.         0, 0, parentwidth, parentheight, 0, bgPixel, bgPixel);
  520. d84 1
  521. a84 1
  522.     XMapSubwindows(d, w);
  523. d88 3
  524. a90 3
  525. void MapParents(d, p)
  526.     Display *d;
  527.     Parms p;
  528. d94 2
  529. a95 2
  530.     for (i = 0; i < parentwindows; i++) {
  531.     XMapWindow(d, parents[i]);
  532. d100 3
  533. a102 3
  534. Bool InitCreate(d, p)
  535.     Display *d;
  536.     Parms p;
  537. d104 2
  538. a105 2
  539.     CreateParents(d, p);
  540.     MapParents(d, p);
  541. d109 3
  542. a111 3
  543. void CreateChildGroup(d, p, parent)
  544.     Display *d;
  545.     Parms p;
  546. d116 2
  547. a117 2
  548.     for (j = 0; j < childwindows; j++) {
  549.     (void) XCreateSimpleWindow (d, parent,
  550. d120 1
  551. a120 1
  552.         CHILDSIZE, CHILDSIZE, 0, bgPixel, fgPixel);
  553. d124 1
  554. a124 1
  555.     XMapSubwindows (d, parent);
  556. d127 3
  557. a129 3
  558. void CreateChildren(d, p)
  559.     Display *d;
  560.     Parms p;
  561. d133 2
  562. a134 2
  563.     for (i = 0; i < parentwindows; i++) {
  564.     CreateChildGroup(d, p, parents[i]);
  565. d138 3
  566. a140 3
  567. void DeleteChildren(d, p)
  568.     Display *d;
  569.     Parms p;
  570. d144 2
  571. a145 2
  572.     for (i = 0; i < parentwindows; i++) {
  573.     XDestroySubwindows(d, parents[i]);
  574. d149 3
  575. a151 3
  576. void EndCreate(d, p)
  577.     Display *d;
  578.     Parms p;
  579. d153 3
  580. a155 1
  581.     XDestroyWindow(d, w);
  582. d159 3
  583. a161 3
  584. Bool InitMap(d, p)
  585.     Display *d;
  586.     Parms p;
  587. d165 2
  588. a166 2
  589.     CreateParents(d, p);
  590.     CreateChildren(d, p);
  591. d170 3
  592. a172 3
  593. void UnmapParents(d, p)
  594.     Display *d;
  595.     Parms p;
  596. d176 2
  597. a177 2
  598.     for (i = 0; i < parentwindows; i++) {
  599.     XUnmapWindow(d, parents[i]);
  600. d181 9
  601. d191 3
  602. a193 3
  603. Bool InitPopups(d, p)
  604.     Display *d;
  605.     Parms p;
  606. d195 27
  607. a221 1
  608.     int i, x, y;
  609. d224 2
  610. a225 3
  611.     ComputeSizes(d, p);
  612.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, NULL, NULL);
  613.     CreateChildGroup(d, p, w);
  614. d228 1
  615. a229 1
  616.     /* ||| Make relative to perfwindow */
  617. d231 5
  618. a235 3
  619.         d, RootWindow(d, 0), 1, 1, parentwidth, parentheight,
  620.         0, fgPixel, bgPixel);
  621.     XChangeWindowAttributes (d, popup, CWOverrideRedirect, &xswa);
  622. d239 3
  623. a241 3
  624. void DoPopUps(d, p)
  625.     Display *d;
  626.     Parms p;
  627. d244 3
  628. a246 3
  629.     for (i = 0; i < p->reps; i++) {
  630.         XMapWindow(d, popup);
  631.     XUnmapWindow(d, popup);
  632. d250 2
  633. a251 2
  634. void EndPopups(d, p)
  635.     Display *d;
  636. d254 2
  637. a255 2
  638.     XDestroyWindow(d, w);
  639.     XDestroyWindow(d, popup);
  640. @
  641.  
  642.  
  643. 2.1
  644. log
  645. @Massive changes, I'm not going to go into details.
  646. @
  647. text
  648. @d20 1
  649. a20 1
  650.     childrows = childwindows/COLS;
  651. d31 1
  652. a31 1
  653.     int i, x, y;
  654. d37 6
  655. a42 2
  656.     parentwindows = parentcolumns * parentrows;
  657.     parents = (Window *)malloc(parentwindows * sizeof(Window));
  658. d47 1
  659. a47 1
  660.     p->reps = parentwindows;
  661. d59 6
  662. a64 11
  663.     i = 0;
  664.     for (x = 0; x < parentcolumns; x++) {
  665.     for (y = 0; y < parentrows; y++) {
  666.         isolate = XCreateSimpleWindow(d, w,
  667.         x*parentwidth, y*parentheight, parentwidth, parentheight,
  668.         0, bgPixel, bgPixel);
  669.         parents[i] = XCreateSimpleWindow(d, isolate,
  670.         0, 0, parentwidth, parentheight,
  671.         0, bgPixel, bgPixel);
  672.         i++;
  673.     }
  674. d66 1
  675. d70 1
  676. d97 1
  677. a97 1
  678.     int j, x, y;
  679. d99 4
  680. a102 6
  681.     j = 0;
  682.     for (x = 0; x < childcolumns; x++) {
  683.     for (y = 0; y < childrows; y++) {
  684.         (void) XCreateSimpleWindow (d, parent,
  685.         (CHILDSIZE+CHILDSPACE) * x + CHILDSPACE/2,
  686.         (CHILDSIZE+CHILDSPACE) * y + CHILDSPACE/2,
  687. a103 4
  688.         j++;
  689.         if (j == childwindows)
  690.         goto Enough;
  691.     }
  692. d105 1
  693. a105 1
  694. Enough: 
  695. d176 1
  696. d178 1
  697. a178 1
  698.         d, RootWindow(d, 0), 50, 50, parentwidth, parentheight,
  699. d189 1
  700. a189 2
  701.     for (i = 0; i < p->reps; i++)
  702.     {
  703. @
  704.  
  705.  
  706. 2.0
  707. log
  708. @version from /usr/src/pmax
  709. @
  710. text
  711. @d3 4
  712. a8 1
  713. static rows, columns;
  714. d10 1
  715. a10 1
  716. void InitWins(d, p)
  717. d14 17
  718. d33 33
  719. a65 3
  720.     if (p->objects < 50) {
  721.     rows = 1;
  722.     columns = p->objects;
  723. d67 11
  724. a77 3
  725.     else {
  726.     columns = COLS;
  727.     rows = p->objects/COLS;
  728. d79 1
  729. a79 2
  730.     p->objects = rows * columns;
  731.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, NULL, NULL);
  732. d81 8
  733. d91 1
  734. a91 1
  735. void DoWins(d, p)
  736. d94 1
  737. d96 1
  738. a96 2
  739.     int     x, y, i;
  740.     int     child;
  741. d98 9
  742. a106 6
  743.     child = 0;
  744.     for (x = 0; x < COLS; x++)
  745.     for (y = 0; y < rows; y++) {
  746.         (void) XCreateSimpleWindow (
  747.             d, w, x*20 + 10, y*20 + 10, 10, 10, 0, bgPixel, fgPixel);
  748.         if ((++child) == p->objects)
  749. d109 1
  750. d112 1
  751. a112 1
  752.     XMapSubwindows (d, w);
  753. d115 1
  754. a115 1
  755. static void CreateSubs(d, p, rows, cols)
  756. a117 1
  757.     int rows, cols;
  758. d119 1
  759. a119 2
  760.     int     x, y, i;
  761.     int     child;
  762. d121 3
  763. a123 10
  764.     child = 0;
  765.     for (x = 0; x < cols; x++)
  766.     for (y = 0; y < rows; y++) {
  767.         (void) XCreateSimpleWindow (
  768.             d, w, x*20 + 10, y*20 + 10, 10, 10, 0, bgPixel, fgPixel);
  769.         if ((++child) == p->objects)
  770.             goto Enough ;
  771.     }
  772. Enough:
  773.     XMapSubwindows (d, w);
  774. d126 1
  775. a126 1
  776. void InitWins2(d, p)
  777. d130 1
  778. a130 1
  779.     int i, x, y;
  780. d132 2
  781. a133 3
  782.     if (p->objects < 50) {
  783.     rows = 1;
  784.     columns = p->objects;
  785. a134 8
  786.     else {
  787.     columns = COLS;
  788.     rows = p->objects/COLS;
  789.     }
  790.     p->objects = rows * columns;
  791.     CreatePerfStuff(d, 1, WIDTH, HEIGHT, &w, NULL, NULL);
  792.     XUnmapWindow(d, w);
  793.     CreateSubs(d, p, rows, columns);
  794. d137 1
  795. a137 1
  796. void DoWins2(d, p)
  797. d141 1
  798. a141 1
  799.     XMapWindow (d, w);
  800. d144 2
  801. a145 1
  802. void UnmapWin(d, p)
  803. d149 5
  804. a153 1
  805.     XUnmapWindow(d, w);
  806. d156 1
  807. a156 1
  808. void InitPopups(d, p)
  809. d160 12
  810. a171 1
  811. #define POPUPCOLS 8
  812. d175 1
  813. a175 9
  814.     if (p->objects < 10) {
  815.     rows = 1;
  816.     columns = p->objects;
  817.     }
  818.     else {
  819.     columns = POPUPCOLS;
  820.     rows = p->objects/POPUPCOLS;
  821.     }
  822.     p->objects = rows * columns;
  823. d177 1
  824. a177 1
  825.     CreateSubs(d, p, rows, columns);
  826. d179 1
  827. d182 2
  828. a183 1
  829.         d, RootWindow(d, 0), 30, 40, 500, 500, 0, fgPixel, bgPixel);
  830. d185 1
  831. a185 1
  832. #undef POPUPCOLS
  833. a205 14
  834. }
  835.  
  836. void DeleteSubs(d, p)
  837.     Display *d;
  838.     Parms p;
  839. {
  840.     XDestroySubwindows(d, w);
  841. }
  842.  
  843. void EndWins(d, p)
  844.     Display *d;
  845.     Parms p;
  846. {
  847.     XDestroyWindow(d, w);
  848. @
  849.  
  850.  
  851. 1.2
  852. log
  853. @Added -fg -bg capabilities
  854. @
  855. text
  856. @@
  857.  
  858.  
  859. 1.1
  860. log
  861. @Initial revision
  862. @
  863. text
  864. @a31 2
  865.     int     wp = WhitePixel (d, 0);
  866.     int     bp = BlackPixel (d, 0);
  867. d37 1
  868. a37 1
  869.             d, w, x*20 + 10, y*20 + 10, 10, 10, 0, wp, bp);
  870. a52 2
  871.     int     wp = WhitePixel (d, 0);
  872.     int     bp = BlackPixel (d, 0);
  873. d58 1
  874. a58 1
  875.             d, w, x*20 + 10, y*20 + 10, 10, 10, 0, wp, bp);
  876. a106 2
  877.     int     wp = WhitePixel (d, 0);
  878.     int     bp = BlackPixel (d, 0);
  879. d122 1
  880. a122 1
  881.         d, RootWindow(d, 0), 30, 40, 500, 500, 0, bp, wp);
  882. @
  883.