[PATCH 6/6] XKB: Fix sense inversion for core MapNotify events

Daniel Stone daniel at fooishbar.org
Wed May 4 18:37:50 PDT 2011


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 <daniel at fooishbar.org>
---
 xkb/xkbEvents.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index d342acc..dfbf7f2 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;
-- 
1.7.4.4



More information about the xorg-devel mailing list