Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!mips!cs.uoregon.edu!ns.uoregon.edu!milton!uw-beaver!mit-eddie!media-lab!howcome From: howcome@media-lab.media.mit.edu (Hakon Lie) Newsgroups: comp.windows.x Subject: Re: Transparent windows Message-ID: Date: 10 Mar 91 02:30:57 GMT References: <1991Mar8.130813.10424@vaxa.strath.ac.uk> Sender: news@media-lab.MEDIA.MIT.EDU Organization: /u2/howcome/.organization Lines: 47 In-reply-to: cadp16@vaxa.strath.ac.uk's message of 8 Mar 91 13:08:13 GMT In article <1991Mar8.130813.10424@vaxa.strath.ac.uk> cadp16@vaxa.strath.ac.uk writes: How would I go about creating a transparent window in X. If your X server supports the Shape extension that came with R4 you can create simple "transparent" windows by specifying a nonrectangular shape. The extension is utilized by oclock and xeyes(R4). Here's an outline of one way of doing this: /* check the extension is there */ if(XShapeQueryExtension (dpy,&shape_event_base, &shape_error_base)) { /* create a pixmap where you specyfy the "mask" */ shape_pm = XCreatePixmap(dpy,RootWindow(dpy,scr), width,height,1); /* set mask values as defined in an image */ XPutImage(dpy,shape_pm,gc,shape_p,0,0,0,0,width,height); /* tell the server to give the window a new shape */ XShapeCombineMask(dpy,win,ShapeBounding,0,0,shape_pm, ShapeSet); } You can easily overload a poor server by specifying a complex shape mask, e.g a checkerboard pattern. See also "X11 nonrectangular window shape extension", by Keith Packard, in mit/doc/extensions/shape.ms -h&kon Hakon W Lie The first howcome@media-lab.media.mit.edu Media Lab, MIT E15-355 thing we do (617) 253-0312 Cambridge, MA 02139 let's kill all USA the lawyers. --Shakespeare -- _____ Hakon W Lie / howcome@media-lab.media.mit.edu ----MIT Media Lab--- (617)253-0312 ----an ec ----s s hnocracy---- ----o ti c tute-of--- hi stic--