diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2008-08-01 16:41:40 +0930 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2008-08-06 11:12:24 +0930 |
commit | d9ca9819e975e0f6832a320f8be5958e5d942f85 (patch) | |
tree | 3210cdd2c396915d008ddbc288df2463163f99d3 /xkb | |
parent | 5ba87c3327786dd7c6e8e265a19c858e8faae8fd (diff) |
xkb: ProcXkbSetGeometry 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.
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkb.c | 87 |
1 files changed, 56 insertions, 31 deletions
@@ -5242,60 +5242,49 @@ char * wire; return Success; } -/* FIXME: Needs to set geom on all core-sending devices. */ -int -ProcXkbSetGeometry(ClientPtr client) +static int +_XkbSetGeometry(ClientPtr client, DeviceIntPtr dev, xkbSetGeometryReq *stuff) { - DeviceIntPtr dev; - XkbGeometryPtr geom,old; - XkbGeometrySizesRec sizes; - Status status; XkbDescPtr xkb; Bool new_name; xkbNewKeyboardNotify nkn; - - REQUEST(xkbSetGeometryReq); - REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq); - - if (!(client->xkbClientFlags&_XkbClientInitialized)) - return BadAccess; - - CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); - CHK_ATOM_OR_NONE(stuff->name); + XkbGeometryPtr geom,old; + XkbGeometrySizesRec sizes; + Status status; xkb= dev->key->xkbInfo->desc; old= xkb->geom; xkb->geom= NULL; - sizes.which= XkbGeomAllMask; + sizes.which= XkbGeomAllMask; sizes.num_properties= stuff->nProperties; - sizes.num_colors= stuff->nColors; - sizes.num_shapes= stuff->nShapes; - sizes.num_sections= stuff->nSections; - sizes.num_doodads= stuff->nDoodads; + sizes.num_colors= stuff->nColors; + sizes.num_shapes= stuff->nShapes; + sizes.num_sections= stuff->nSections; + sizes.num_doodads= stuff->nDoodads; sizes.num_key_aliases= stuff->nKeyAliases; if ((status= XkbAllocGeometry(xkb,&sizes))!=Success) { - xkb->geom= old; - return status; + xkb->geom= old; + return status; } geom= xkb->geom; geom->name= stuff->name; geom->width_mm= stuff->widthMM; geom->height_mm= stuff->heightMM; if ((status= _CheckSetGeom(geom,stuff,client))!=Success) { - XkbFreeGeometry(geom,XkbGeomAllMask,True); - xkb->geom= old; - return status; + XkbFreeGeometry(geom,XkbGeomAllMask,True); + xkb->geom= old; + return status; } new_name= (xkb->names->geometry!=geom->name); xkb->names->geometry= geom->name; if (old) - XkbFreeGeometry(old,XkbGeomAllMask,True); + XkbFreeGeometry(old,XkbGeomAllMask,True); if (new_name) { - xkbNamesNotify nn; - bzero(&nn,sizeof(xkbNamesNotify)); - nn.changed= XkbGeometryNameMask; - XkbSendNamesNotify(dev,&nn); + xkbNamesNotify nn; + bzero(&nn,sizeof(xkbNamesNotify)); + nn.changed= XkbGeometryNameMask; + XkbSendNamesNotify(dev,&nn); } nkn.deviceID= nkn.oldDeviceID= dev->id; nkn.minKeyCode= nkn.oldMinKeyCode= xkb->min_key_code; @@ -5307,6 +5296,42 @@ ProcXkbSetGeometry(ClientPtr client) return Success; } +int +ProcXkbSetGeometry(ClientPtr client) +{ + DeviceIntPtr dev; + int rc; + + REQUEST(xkbSetGeometryReq); + REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq); + + if (!(client->xkbClientFlags&_XkbClientInitialized)) + return BadAccess; + + CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess); + CHK_ATOM_OR_NONE(stuff->name); + + rc = _XkbSetGeometry(client, dev, stuff); + if (rc != Success) + return rc; + + if (stuff->deviceSpec == XkbUseCoreKbd) + { + DeviceIntPtr other; + for (other = inputInfo.devices; other; other = other->next) + { + if ((other != dev) && other->key && !other->isMaster && (other->u.master == dev)) + { + rc = XaceHook(XACE_DEVICE_ACCESS, client, other, DixManageAccess); + if (rc == Success) + _XkbSetGeometry(client, other, stuff); + } + } + } + + return Success; +} + /***====================================================================***/ int |