xkb: ProcXkbSetDeviceInfo should work on all attached SDs.
If called with XkbUseCoreKbd, run through all attached SDs and replicate the
call. This way, we keep the SDs in sync with the MD as long as core clients
control the MDs.
(cherry picked from commit c06e27b2f6
)
This commit is contained in:
parent
07e922a257
commit
582f1381ae
106
xkb/xkb.c
106
xkb/xkb.c
|
@ -6418,25 +6418,15 @@ DeviceIntPtr kbd;
|
||||||
return (char *)ledWire;
|
return (char *)ledWire;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Needs to set info on all core-sending devices. */
|
|
||||||
int
|
static int
|
||||||
ProcXkbSetDeviceInfo(ClientPtr client)
|
_XkbSetDeviceInfo(ClientPtr client, DeviceIntPtr dev,
|
||||||
|
xkbSetDeviceInfoReq *stuff)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
unsigned change;
|
||||||
unsigned change;
|
char *wire;
|
||||||
char * wire;
|
|
||||||
xkbExtensionDeviceNotify ed;
|
|
||||||
|
|
||||||
REQUEST(xkbSetDeviceInfoReq);
|
change = stuff->change;
|
||||||
REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
|
|
||||||
|
|
||||||
if (!(client->xkbClientFlags&_XkbClientInitialized))
|
|
||||||
return BadAccess;
|
|
||||||
|
|
||||||
change= stuff->change;
|
|
||||||
|
|
||||||
CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
|
|
||||||
CHK_MASK_LEGAL(0x01,change,XkbXI_AllFeaturesMask);
|
|
||||||
|
|
||||||
wire= (char *)&stuff[1];
|
wire= (char *)&stuff[1];
|
||||||
if (change&XkbXI_ButtonActionsMask) {
|
if (change&XkbXI_ButtonActionsMask) {
|
||||||
|
@ -6461,6 +6451,17 @@ xkbExtensionDeviceNotify ed;
|
||||||
if (((wire-((char *)stuff))/4)!=stuff->length)
|
if (((wire-((char *)stuff))/4)!=stuff->length)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_XkbSetDeviceInfoCheck(ClientPtr client, DeviceIntPtr dev,
|
||||||
|
xkbSetDeviceInfoReq *stuff)
|
||||||
|
{
|
||||||
|
unsigned change;
|
||||||
|
char *wire;
|
||||||
|
xkbExtensionDeviceNotify ed;
|
||||||
|
|
||||||
bzero((char *)&ed,SIZEOF(xkbExtensionDeviceNotify));
|
bzero((char *)&ed,SIZEOF(xkbExtensionDeviceNotify));
|
||||||
ed.deviceID= dev->id;
|
ed.deviceID= dev->id;
|
||||||
wire= (char *)&stuff[1];
|
wire= (char *)&stuff[1];
|
||||||
|
@ -6501,6 +6502,77 @@ xkbExtensionDeviceNotify ed;
|
||||||
}
|
}
|
||||||
if ((stuff->change)&&(ed.reason))
|
if ((stuff->change)&&(ed.reason))
|
||||||
XkbSendExtensionDeviceNotify(dev,client,&ed);
|
XkbSendExtensionDeviceNotify(dev,client,&ed);
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ProcXkbSetDeviceInfo(ClientPtr client)
|
||||||
|
{
|
||||||
|
unsigned int change;
|
||||||
|
DeviceIntPtr dev;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
REQUEST(xkbSetDeviceInfoReq);
|
||||||
|
REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
|
||||||
|
|
||||||
|
if (!(client->xkbClientFlags&_XkbClientInitialized))
|
||||||
|
return BadAccess;
|
||||||
|
|
||||||
|
change = stuff->change;
|
||||||
|
|
||||||
|
CHK_ANY_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
|
||||||
|
CHK_MASK_LEGAL(0x01,change,XkbXI_AllFeaturesMask);
|
||||||
|
|
||||||
|
rc = _XkbSetDeviceInfoCheck(client, dev, stuff);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
if (stuff->deviceSpec == XkbUseCoreKbd || stuff->deviceSpec == XkbUseCorePtr)
|
||||||
|
{
|
||||||
|
DeviceIntPtr other;
|
||||||
|
for (other = inputInfo.devices; other; other = other->next)
|
||||||
|
{
|
||||||
|
if (((other != dev) && other->coreEvents) &&
|
||||||
|
((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
|
||||||
|
(stuff->deviceSpec == XkbUseCorePtr && other->button)))
|
||||||
|
{
|
||||||
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
|
||||||
|
if (rc == Success)
|
||||||
|
{
|
||||||
|
rc = _XkbSetDeviceInfoCheck(client, other, stuff);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* checks done, apply */
|
||||||
|
rc = _XkbSetDeviceInfo(client, dev, stuff);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
if (stuff->deviceSpec == XkbUseCoreKbd || stuff->deviceSpec == XkbUseCorePtr)
|
||||||
|
{
|
||||||
|
DeviceIntPtr other;
|
||||||
|
for (other = inputInfo.devices; other; other = other->next)
|
||||||
|
{
|
||||||
|
if (((other != dev) && other->coreEvents) &&
|
||||||
|
((stuff->deviceSpec == XkbUseCoreKbd && other->key) ||
|
||||||
|
(stuff->deviceSpec == XkbUseCorePtr && other->button)))
|
||||||
|
{
|
||||||
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess);
|
||||||
|
if (rc == Success)
|
||||||
|
{
|
||||||
|
rc = _XkbSetDeviceInfo(client, other, stuff);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user