[comp.windows.x] How to shape a window

pjv@fctunl.rccn.pt (Pedro Jorge Veiga) (06/04/90)

Could someone please let me know (email) of any leads on how to create
a widget that can assume any shape? I am a novice programmer on the X
system and have been nosing around xeyes but all seems very confusing
to me. I'm working on a project that involves displaying several
objects (the problem is dealing with rivers and roads!) on a map and 
by clicking on them retrieving some kind of information. The map is 
supposed to be visible underneath and not partially obscured by the
window mask. 

Thanks in advance.
--
Pedro Veiga     

BITNET/Internet: pjv@fctunl.rccn.pt
           UUCP: pjv@unl.uucp

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (06/05/90)

> Could someone please let me know (email) of any leads on how to
> create a widget that can assume any shape?

I can tell you how to give a window a shape.  I haven't a clue how this
would interact with the toolkit or widget mechanisms.

First, make sure your libraries and server support the SHAPE extension.
(This pretty much means they have to be R4.)

Then all you need to do is use XShapeCombineRegion,
XShapeCombineRectangles, XShapeCombineMask or XShapeCombineShape to
give your window the shape you want.

Xeyes, I feel sure, uses XShapeCombineMask; representing those ovals as
lists of rectangles would be a lot more work than it's worth.

Look at the R4 documentation on the SHAPE extension for more info.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (06/05/90)

XmuReshapeWidget (mit/lib/Xmu/ShapeWidg.c) will give you one example of a
function that shapes a widget.  Coupled with XmuCvtStringToShapeStyle
(mit/lib/Xmu/StrToShap.c) for defining shapes via resources.