home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1811 / changes
Text File  |  1990-12-28  |  3KB  |  97 lines

  1. *** root.c.old    Tue Sep 11 17:09:30 1990
  2. --- root.c    Tue Sep 11 17:16:35 1990
  3. ***************
  4. *** 93,98 ****
  5. --- 93,109 ----
  6.       }
  7.   }
  8.   
  9. + /*
  10. +  * Modified to search for a virtual root window based on code from
  11. +  * Tom LaStrange (toml@solbourne.com) in the tvtwm distribution.
  12. +  * I doubt that I got all the other possible places changes are needed,
  13. +  * especially w.r.t. colormaps.
  14. +  *
  15. +  * George Ferguson, ferguson@cs.rochester.edu, 11 Sep 1990.
  16. +  */
  17. + static Window getRootWindow();
  18.   void imageOnRoot(disp, scrn, image, verbose)
  19.        Display      *disp;
  20.        int           scrn;
  21. ***************
  22. *** 100,109 ****
  23.        unsigned int  verbose;
  24.   { Pixmap   pixmap;
  25.     Colormap xcmap;
  26.   
  27.   
  28. !   freePrevious(disp, RootWindow(disp, scrn));
  29.   
  30.     if (! sendImageToX(disp, scrn, DefaultVisual(disp, scrn), image,
  31.                &pixmap, &xcmap, verbose))
  32.       exit(1);
  33. --- 111,123 ----
  34.        unsigned int  verbose;
  35.   { Pixmap   pixmap;
  36.     Colormap xcmap;
  37. +   Window root;
  38.   
  39.   
  40. !   root = getRootWindow(disp,scrn);
  41.   
  42. +   freePrevious(disp, root);
  43.     if (! sendImageToX(disp, scrn, DefaultVisual(disp, scrn), image,
  44.                &pixmap, &xcmap, verbose))
  45.       exit(1);
  46. ***************
  47. *** 117,124 ****
  48.       exit(1);
  49.     }
  50.   
  51. !   XSetWindowBackgroundPixmap(disp, RootWindow(disp, scrn), pixmap);
  52. !   XClearWindow(disp, RootWindow(disp, scrn));
  53.     XFreePixmap(disp, pixmap);
  54. !   preserveResource(disp, RootWindow(disp, scrn));
  55.   }
  56. --- 131,167 ----
  57.       exit(1);
  58.     }
  59.   
  60. !   XSetWindowBackgroundPixmap(disp, root, pixmap);
  61. !   XClearWindow(disp, root);
  62.     XFreePixmap(disp, pixmap);
  63. !   preserveResource(disp, root);
  64. ! }
  65. ! /*
  66. !  * This is more or less directly from ssetroot.c in the tvtwm distribution.
  67. !  */
  68. ! static Window
  69. ! getRootWindow(disp,scrn)
  70. ! Display *disp;
  71. ! int scrn;
  72. ! {
  73. !     Atom __SWM_VROOT,actual_type;
  74. !     Window root,rootReturn,parentReturn,*children,*newRoot;
  75. !     int numChildren,i,actual_format;
  76. !     long nitems, bytesafter;
  77. !     root = RootWindow(disp,scrn);
  78. !     __SWM_VROOT = XInternAtom(disp,"__SWM_VROOT",False);
  79. !     XQueryTree(disp,root,&rootReturn,&parentReturn,&children,&numChildren);
  80. !     for (i = 0; i < numChildren; i++) {
  81. !     newRoot = NULL;
  82. !         if (XGetWindowProperty (disp, children[i], __SWM_VROOT,0,1,
  83. !         False,XA_WINDOW,&actual_type,&actual_format,&nitems,&bytesafter,
  84. !         (unsigned char **)&newRoot) == Success && newRoot) {
  85. !             root = *newRoot;
  86. !             break;
  87. !         }
  88. !     }
  89. !     return(root);
  90.   }
  91.