Move master/lastSlave out of the union into separate fields.
The removal of the double-use will cause some suble bugs as some conditions to check for the dev->u.master case were broken and also evaluated as true if lastSlave was set (instead of master). Also breaks the input ABI. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
This commit is contained in:
parent
77113dd3ee
commit
17265ccb02
|
@ -457,8 +457,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
{
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
{
|
||||
if (IsMaster(other) && other->u.lastSlave == dev)
|
||||
other->u.lastSlave = NULL;
|
||||
if (IsMaster(other) && other->lastSlave == dev)
|
||||
other->lastSlave = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -988,7 +988,7 @@ CloseDownDevices(void)
|
|||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
{
|
||||
if (!IsMaster(dev) && !IsFloating(dev))
|
||||
dev->u.master = NULL;
|
||||
dev->master = NULL;
|
||||
}
|
||||
|
||||
CloseDeviceList(&inputInfo.devices);
|
||||
|
@ -2486,7 +2486,7 @@ GetMaster(DeviceIntPtr dev, int which)
|
|||
if (IsMaster(dev))
|
||||
master = dev;
|
||||
else
|
||||
master = dev->u.master;
|
||||
master = dev->master;
|
||||
|
||||
if (master && which != MASTER_ATTACHED)
|
||||
{
|
||||
|
@ -2541,7 +2541,7 @@ AllocDevicePair (ClientPtr client, char* name,
|
|||
pointer->coreEvents = TRUE;
|
||||
pointer->spriteInfo->spriteOwner = TRUE;
|
||||
|
||||
pointer->u.lastSlave = NULL;
|
||||
pointer->lastSlave = NULL;
|
||||
pointer->last.slave = NULL;
|
||||
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
||||
|
||||
|
@ -2567,7 +2567,7 @@ AllocDevicePair (ClientPtr client, char* name,
|
|||
keyboard->coreEvents = TRUE;
|
||||
keyboard->spriteInfo->spriteOwner = FALSE;
|
||||
|
||||
keyboard->u.lastSlave = NULL;
|
||||
keyboard->lastSlave = NULL;
|
||||
keyboard->last.slave = NULL;
|
||||
keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
|
||||
|
||||
|
|
|
@ -3244,8 +3244,8 @@ ProcWarpPointer(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if (dev->u.lastSlave)
|
||||
dev = dev->u.lastSlave;
|
||||
if (dev->lastSlave)
|
||||
dev = dev->lastSlave;
|
||||
pSprite = dev->spriteInfo->sprite;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
|
|
|
@ -273,10 +273,10 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
|
|||
do_modmap_change(client, tmp, modmap);
|
||||
}
|
||||
}
|
||||
else if (!IsFloating(dev) && GetMaster(dev, MASTER_KEYBOARD)->u.lastSlave == dev) {
|
||||
else if (!IsFloating(dev) && GetMaster(dev, MASTER_KEYBOARD)->lastSlave == dev) {
|
||||
/* If this fails, expect the results to be weird. */
|
||||
if (check_modmap_change(client, dev->u.master, modmap))
|
||||
do_modmap_change(client, dev->u.master, modmap);
|
||||
if (check_modmap_change(client, dev->master, modmap))
|
||||
do_modmap_change(client, dev->master, modmap);
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
|
|
@ -530,10 +530,8 @@ typedef struct _DeviceIntRec {
|
|||
PrivateRec *devPrivates;
|
||||
DeviceUnwrapProc unwrapProc;
|
||||
SpriteInfoPtr spriteInfo;
|
||||
union {
|
||||
DeviceIntPtr master; /* master device */
|
||||
DeviceIntPtr lastSlave; /* last slave device used */
|
||||
} u;
|
||||
DeviceIntPtr master; /* master device */
|
||||
DeviceIntPtr lastSlave; /* last slave device used */
|
||||
|
||||
/* last valuator values recorded, not posted to client;
|
||||
* for slave devices, valuators is in device coordinates
|
||||
|
|
|
@ -402,7 +402,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
|
|||
master = CopyGetMasterEvent(dev, event, &mevent);
|
||||
|
||||
if (master)
|
||||
master->u.lastSlave = dev;
|
||||
master->lastSlave = dev;
|
||||
|
||||
/* If someone's registered a custom event handler, let them
|
||||
* steal it. */
|
||||
|
|
|
@ -185,7 +185,7 @@ static void test_XIQueryPointer(void)
|
|||
request_XIQueryPointer(&client_request, &request, BadDevice);
|
||||
|
||||
test_data.dev = devices.mouse;
|
||||
devices.mouse->u.master = NULL; /* Float, kind-of */
|
||||
devices.mouse->master = NULL; /* Float, kind-of */
|
||||
request.deviceid = devices.mouse->id;
|
||||
request_XIQueryPointer(&client_request, &request, Success);
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ static void test_XIWarpPointer(void)
|
|||
request.deviceid = devices.kbd->id;
|
||||
request_XIWarpPointer(&client_request, &request, BadDevice);
|
||||
|
||||
devices.mouse->u.master = NULL; /* Float, kind-of */
|
||||
devices.mouse->master = NULL; /* Float, kind-of */
|
||||
request.deviceid = devices.mouse->id;
|
||||
request_XIWarpPointer(&client_request, &request, Success);
|
||||
|
||||
|
|
|
@ -5885,7 +5885,7 @@ ProcXkbGetKbdByName(ClientPtr client)
|
|||
|
||||
if (!IsMaster(dev)) {
|
||||
DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
|
||||
if (master && master->u.lastSlave == dev) {
|
||||
if (master && master->lastSlave == dev) {
|
||||
XkbCopyDeviceKeymap(master, dev);
|
||||
XkbSendNewKeyboardNotify(dev,&nkn);
|
||||
}
|
||||
|
|
|
@ -1365,7 +1365,7 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat
|
|||
|
||||
if (IsMaster(dev)) {
|
||||
mpointer = GetMaster(dev, MASTER_POINTER);
|
||||
lastSlave = mpointer->u.lastSlave;
|
||||
lastSlave = mpointer->lastSlave;
|
||||
ptr = GetXTestDevice(mpointer);
|
||||
} else if (IsFloating(dev))
|
||||
ptr = dev;
|
||||
|
|
Loading…
Reference in New Issue