Input region support in the Shape extension

Keith Packard keithp at keithp.com
Thu Jan 27 23:27:40 PST 2005


I've hacked the Shape extension to expose an 'input' region for windows.

This is a region which is a subset of the Bounding region which restricts
which portion of the window receives mouse events.  Portions of the window
not in the Input region pass the mouse right on through to underlying
windows.

It was amazingly easy to implement; about 15 lines of code.

The semantics seem obvious as well; in parallel with the Clip region it 
limits the Input region to the intersection of the Input region, the 
Bounding region and extents of the window.

The only real questions are how I should advertise this new feature.  My 
initial plan was to bump the Shape protocol version to 1.1 and leave it at 
that.  There's no version negotiation in the current Shape protocol; the 
client simply asks the server for the version, so we can't reject "old" 
clients sending this new region name across the wire.  I figure that's 
mostly harmless.

The salient part of the extension is two copies of the following five 
lines of code in dispatch.c and events.c:

+               && (!wInputShape(pWin) ||
+                   POINT_IN_REGION(pWin->drawable.pScreen,
+                                   wInputShape(pWin),
+                                   x - pWin->drawable.x,
+                                   y - pWin->drawable.y, &box))

wInputShape is a new macro which pulls the inputShape as defined by the 
client out of the window extra record; the point here is in screen space 
and so must be translated to window space before it can be compared with 
the region.

Other than this technical change, the remaining changes deal with managing 
the region creation/destruction and the like.

I will probably just commit this change to xserver unless someone can 
express significant concerns over its function or the method of 
advertisement.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20050127/f11d1dfc/attachment.pgp>


More information about the xorg mailing list