Adding input masking to Composite extension

Keith Packard keithp at
Fri Nov 23 16:27:32 PST 2007

To eliminate the need for computing an input shape for translucent
windows, it seems like just using the existing 'alpha' bits in the pixel
would make it very easy to do input hit detection.

Here's a couple of proposed additions to the Composite extension for
doing just that:

13. Input clipping (0.5 and later)


                window:                         Window
                mask:                           CARD32
                lower:                          CARD32
                upper                           CARD32

        When determining whether the cursor is inside 'window', the pixel
        value ('pixel') at the cursor location is fetched and tested:

            bool pixel_is_inside (pixel, mask, upper, lower)
                if (lower < upper)
                    return lower <= (pixel & mask) && upper < (pixel & mask)
                    return lower <= (pixel & mask) || upper < (pixel & mask)

        This test provides an additional constraint on inclusion, so other
        tests involving normal window occlusion must also be satisfied for
        the pixel to be included.

        All three of these values are zero by default, making the above
        function always true.


                window:                         Window


                mask:                           CARD32
                lower:                          CARD32
                upper                           CARD32

        This returns the current input mask values.

keith.packard at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the xorg mailing list