From dc57f89959e549403f8488eb9f23425bd7118b22 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 11 Feb 2011 12:47:37 +1000 Subject: Switch to use IsFloating() This is not a straightforward search/replacement due to a long-standing issue. dev->u.master is the same field as dev->u.lastSlave. Thus, if dev is a master device, a check for dev->u.master may give us false positives and false negatives. The switch to IsFloating() spells out these cases and modifies the conditions accordingly to cover both cases. Signed-off-by: Peter Hutterer Reviewed-by: Benjamin Tissoires --- xkb/xkb.c | 2 +- xkb/xkbAccessX.c | 2 +- xkb/xkbActions.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'xkb') diff --git a/xkb/xkb.c b/xkb/xkb.c index a57139f35..4557350bf 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -5883,7 +5883,7 @@ ProcXkbGetKbdByName(ClientPtr client) nkn.changed|= XkbNKN_GeometryMask; XkbSendNewKeyboardNotify(dev,&nkn); - if (!IsMaster(dev) && dev->u.master) + if (!IsMaster(dev) && !IsFloating(dev)) { DeviceIntPtr master = dev->u.master; if (master->u.lastSlave == dev) diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c index 10c38ca47..12fe2a1f5 100644 --- a/xkb/xkbAccessX.c +++ b/xkb/xkbAccessX.c @@ -694,7 +694,7 @@ ProcessInputProc backupproc; xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); DeviceEvent *event = &ev->device_event; - dev = (IsMaster(mouse) || mouse->u.master) ? GetMaster(mouse, MASTER_KEYBOARD) : mouse; + dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD); if (dev && dev->key) { diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 8d7c124e8..eda409c07 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -1367,7 +1367,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat mpointer = GetMaster(dev, MASTER_POINTER); lastSlave = mpointer->u.lastSlave; ptr = GetXTestDevice(mpointer); - } else if (!dev->u.master) + } else if (IsFloating(dev)) ptr = dev; else return; @@ -1397,7 +1397,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y) int gpe_flags = 0; /* ignore attached SDs */ - if (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) != NULL) + if (!IsMaster(dev) && !IsFloating(dev)) return; if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) @@ -1427,7 +1427,7 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button) if (IsMaster(dev)) { DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER); ptr = GetXTestDevice(mpointer); - } else if (!dev->u.master) + } else if (IsFloating(dev)) ptr = dev; else return; -- cgit v1.2.3