diff --git a/Xi/exevents.c b/Xi/exevents.c index f06aed07d..da10040da 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -95,6 +95,22 @@ static Bool MakeInputMasks(WindowPtr /* pWin */ /* Used to sture classes currently not in use by an MD */ extern DevPrivateKey UnusedClassesPrivateKey; +/* + * Only let the given client know of core events which will affect its + * interpretation of input events, if the client's ClientPointer (or the + * paired keyboard) is the current device. + */ +int +XIShouldNotify(ClientPtr client, DeviceIntPtr dev) +{ + DeviceIntPtr current_ptr = PickPointer(client); + DeviceIntPtr current_kbd = GetPairedDevice(current_ptr); + + if (dev == current_kbd || dev == current_ptr) + return 1; + + return 0; +} void RegisterOtherDevice(DeviceIntPtr device) diff --git a/include/exevents.h b/include/exevents.h index 8ddfbf9e8..abe1a5f23 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -255,4 +255,9 @@ extern _X_EXPORT int XIPropToFloat( float **buf_return ); +/* For an event such as MappingNotify which affects client interpretation + * of input events sent by device dev, should we notify the client, or + * would it merely be irrelevant and confusing? */ +extern _X_EXPORT int XIShouldNotify(ClientPtr client, DeviceIntPtr dev); + #endif /* EXEVENTS_H */