Adding input masking to Composite extension

Keith Packard keithp at keithp.com
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)

    SetInputMask

                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)
                else
                    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.

    GetInputMask

                window:                         Window


                ->

                mask:                           CARD32
                lower:                          CARD32
                upper                           CARD32

        This returns the current input mask values.


-- 
keith.packard at intel.com
-------------- 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: <http://lists.x.org/archives/xorg/attachments/20071123/9c232abb/attachment.pgp>


More information about the xorg mailing list