[PATCH v2] xkb: Fix a check for MASTER_KEYBOARD

Peter Hutterer peter.hutterer at who-t.net
Sun Feb 20 22:00:23 PST 2011


And copy into the master keyboard, not just the directly attached device.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
On Fri, Feb 18, 2011 at 10:48:10AM +0100, Benjamin Tissoires wrote:
> >@@ -5883,9 +5884,8 @@ ProcXkbGetKbdByName(ClientPtr client)
> >         nkn.changed|= XkbNKN_GeometryMask;
> >     XkbSendNewKeyboardNotify(dev,&nkn);
> >
> >-    if (!IsMaster(dev)&&  !IsFloating(dev))
> >+    if (!IsMaster(dev)&&  (master = GetMaster(dev, MASTER_KEYBOARD)))
> 
> I had a quick watch on the series, and this line worries me: I all
> the time consider putting an affectation in a test as a bug (or
> source of bug) as it's ambiguous. I know that it's valid in this
> case, but I don't like it.
> 
> Sorry for the noise if you consider this as valid. ;)

who am I to argue with that :)

another change: the previous patch would still copy the keymap into the
attached master, not the master keyboard. fix this.

 xkb/xkb.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/xkb/xkb.c b/xkb/xkb.c
index 43d847a..5da2814 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5883,12 +5883,10 @@ ProcXkbGetKbdByName(ClientPtr client)
 	    nkn.changed|= XkbNKN_GeometryMask;
 	XkbSendNewKeyboardNotify(dev,&nkn);
 
-	if (!IsMaster(dev) && !IsFloating(dev))
-	{
-	    DeviceIntPtr master = dev->u.master;
-	    if (master->u.lastSlave == dev)
-	    {
-		XkbCopyDeviceKeymap(dev->u.master, dev);
+	if (!IsMaster(dev)) {
+	    DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
+	    if (master && master->u.lastSlave == dev) {
+		XkbCopyDeviceKeymap(master, dev);
 		XkbSendNewKeyboardNotify(dev,&nkn);
 	    }
 	}
-- 
1.7.4



More information about the xorg-devel mailing list