diff --git a/dix/events.c b/dix/events.c index 0db2d6a5b..d34d7399a 100644 --- a/dix/events.c +++ b/dix/events.c @@ -345,11 +345,20 @@ static Mask lastEventMask; extern int DeviceMotionNotify; -/** - * Event filters. One set of filters for each device, but only the first layer - * is initialized. The rest is memcpy'd in InitEvents. - */ #define CantBeFiltered NoEventMask +/** + * Event masks for each event type. + * + * One set of filters for each device, but only the first layer + * is initialized. The rest is memcpy'd in InitEvents. + * + * Filters are used whether a given event may be delivered to a client, + * usually in the form of if (window-event-mask & filter); then deliver event. + * + * One notable filter is for PointerMotion/DevicePointerMotion events. Each + * time a button is pressed, the filter is modified to also contain the + * matching ButtonXMotion mask. + */ static Mask filters[MAXDEVICES][128] = { { NoSuchEvent, /* 0 */ @@ -3621,7 +3630,7 @@ FixKeyState (xEvent *xE, DeviceIntPtr keybd) * The otherEventMasks on a WindowOptional is the combination of all event * masks set by all clients on the window. * deliverableEventMask is the combination of the eventMask and the - * otherEventMask. + * otherEventMask plus the events that may be propagated to the parent. * * Traverses to siblings and parents of the window. */ diff --git a/include/inputstr.h b/include/inputstr.h index 2b6de02d9..bed71be37 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -65,24 +65,66 @@ SOFTWARE. #define EMASKSIZE MAXDEVICES + 1 -/* Kludge: OtherClients and InputClients must be compatible, see code */ - +/** + * This struct stores the core event mask for each client except the client + * that created the window. + * + * Each window that has events selected from other clients has at least one of + * these masks. If multiple clients selected for events on the same window, + * these masks are in a linked list. + * + * The event mask for the client that created the window is stored in + * win->eventMask instead. + * + * The resource id is simply a fake client ID to associate this mask with a + * client. + * + * Kludge: OtherClients and InputClients must be compatible, see code. + */ typedef struct _OtherClients { - OtherClientsPtr next; - XID resource; /* id for putting into resource manager */ - Mask mask; + OtherClientsPtr next; /**< Pointer to the next mask */ + XID resource; /**< id for putting into resource manager */ + Mask mask; /**< Core event mask */ } OtherClients; +/** + * This struct stores the XI event mask for each client. + * + * Each window that has events selected has at least one of these masks. If + * multiple client selected for events on the same window, these masks are in + * a linked list. + */ typedef struct _InputClients { - InputClientsPtr next; - XID resource; /* id for putting into resource manager */ - Mask mask[EMASKSIZE]; + InputClientsPtr next; /**< Pointer to the next mask */ + XID resource; /**< id for putting into resource manager */ + Mask mask[EMASKSIZE]; /**< Actual XI event mask, deviceid is index */ } InputClients; +/** + * Combined XI event masks from all devices. + * + * This is the XI equivalent of the deliverableEvents, eventMask and + * dontPropagate mask of the WindowRec (or WindowOptRec). + * + * A window that has an XI client selecting for events has exactly one + * OtherInputMasks struct and exactly one InputClients struct hanging off + * inputClients. Each further client appends to the inputClients list. + * Each Mask field is per-device, with the device id as the index. + * Exception: for non-device events (Presence events), the MAX_DEVICES + * deviceid is used. + */ typedef struct _OtherInputMasks { + /** + * Bitwise OR of all masks by all clients and the window's parent's masks. + */ Mask deliverableEvents[EMASKSIZE]; + /** + * Bitwise OR of all masks by all clients on this window. + */ Mask inputEvents[EMASKSIZE]; + /** The do-not-propagate masks for each device. */ Mask dontPropagateMask[EMASKSIZE]; + /** The clients that selected for events */ InputClientsPtr inputClients; } OtherInputMasks; diff --git a/include/windowstr.h b/include/windowstr.h index 8ce32305e..720803af7 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -153,8 +153,8 @@ typedef struct _Window { RegionRec borderSize; DDXPointRec origin; /* position relative to parent */ unsigned short borderWidth; - unsigned short deliverableEvents; - Mask eventMask; + unsigned short deliverableEvents; /* all masks from all clients */ + Mask eventMask; /* mask from the creating client */ PixUnion background; PixUnion border; pointer backStorage; /* null when BS disabled */