From 3231962db826f5efd431596a309c96e907a191d1 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 3 May 2011 03:20:23 +0100 Subject: XKB: Fix sense inversion for core MapNotify events Due to an unfortunate sense inversion incident while switching from a if (foo) { ... } to if (!foo) continue; style in f06a9d, we punished any client who attempted to use XKB to restrict the MapNotify events they wanted by sending them exactly the events they _didn't_ want, and nothing else. NewKeyboardNotifies (coming from a client setting the map with an XKB request, when switching between master devices, etc) weren't affected, but this would impact anyone using xmodmap-style core requests. Could explain a fair bit. Clarified the comments while I was at it. Signed-off-by: Daniel Stone Reviewed-by: Peter Hutterer --- xkb/xkbEvents.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index d342acc28..dfbf7f2b3 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -88,11 +88,15 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed, if (!clients[i] || clients[i]->clientState != ClientStateRunning) continue; - /* Ignore clients which will have already received this. - * Inconsistent with themselves, but consistent with previous - * behaviour.*/ - if (xkb_event == XkbMapNotify && (clients[i]->mapNotifyMask & changed)) + /* XKB allows clients to restrict the MappingNotify events sent to + * them. This was broken for three years. Sorry. */ + if (xkb_event == XkbMapNotify && + (clients[i]->xkbClientFlags & _XkbClientInitialized) && + !(clients[i]->mapNotifyMask & changed)) continue; + /* Emulate previous server behaviour: any client which has activated + * XKB will not receive core events emulated from a NewKeyboardNotify + * at all. */ if (xkb_event == XkbNewKeyboardNotify && (clients[i]->xkbClientFlags & _XkbClientInitialized)) continue; -- cgit v1.2.3