Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!wuarchive!zaphod.mps.ohio-state.edu!samsung!umich!umeecs!msi-s0.msi.umn.edu!cs.umn.edu!dmshq!com50!pai!erc From: erc@pai.UUCP (Eric Johnson) Newsgroups: comp.windows.x Subject: Re: Info on: SHAPE or XINPUT or Multiple buffering with X wanted Summary: Info on SHAPE Keywords: SHAPE, XINPUT, BUFFER, ANIMATION X11R4 Message-ID: <1411@pai.UUCP> Date: 31 Aug 90 15:05:02 GMT References: <1990Aug30.094024.25974@abblund.se> Organization: Boulware Technologies, Inc., Burnsville, MN Lines: 82 In article <1990Aug30.094024.25974@abblund.se>, erik@abblund.se (Erik Sparre) writes: > I need information about the following X extensions: > > SHAPE - allows widgets to be non-rectangular (I think). > XINPUT - > Multiple buffering - [...] > I don't know much about SHAPE and XINPUT, so every piece of information > is welcome. > > -- > Erik Sparre | Email erik@abblund.se > ABB Corporate Research | Phone +46 46 168527 > Dept. KLL, Lab for Man-Machine Communication | Telex 33709 > IDEON Research Park, S-223 70 LUND, SWEDEN | Fax +46 46 145620 The SHAPE extension to X11 R4 is described in a document titled "X11 Nonrectangular Window SHAPE Extension" v. 1.0 by Keith Packard. Basically skip over the text until section 7 ("C language binding"). The main idea is that a window in X can have a shape other than a rectangle. A clock, for example, can be round (see oclock im X11R4). If you don't have this extension (or another like it), all your windows in X are rectangles. The simplest way to test this out (assuming your version of X has this extension) is to create a bitmap and then set a window's shape to that bitmap. Its kind of fun. (I'm assuming you know Xlib...) In brief: #include /* add this include file */ ... /* set up your display connection, create a window, etc... */ ... /* create a depth 1 bitmap with whatever bits set you want */ XShapeCombineMask( display, window, ShapeBounding, 0, 0, bitmap_shape, ShapeSet ); XMapWindow( display, window ); Where: bitmap_shape is a depth 1 pixmap (in other words, a bitmap). You can also use regions to set up the shape for a window. (A caveat, though, rectangular regions work better than circular ones on performance. A window made up of 100 filled rectangles performs much better than one made up of 100 filled circles.) When you link your program, link with the Xext library as well: cc -o foo foo.c -lXext -lX11 Or something like that. Note: You may want to test for the existence of this extension before trying to use it. See the XShapeQueryExtension() description. Using the SHAPE extension proved to be really easy. It took me about five minutes to figure out Packard's description of how the SHAPE extension works (one of the few areas of X that was easy to figure out :-) Try it, its fun. Kevin Reichard and I put a brief (but less brief than this) discussion in our latest book, _Advanced X Window Applications Programming_, which I was told is just hitting the stores. (Call 1-800-MANUALS for more information). Hope this helps, -Eric -- Eric F. Johnson phone: +1 612 894 0313 BTI: Industrial Boulware Technologies, Inc. fax: +1 612 894 0316 automation systems 415 W. Travelers Trail email: erc@pai.mn.org and services Burnsville, MN 55337 USA