dix: use PickPointer() and PickKeyboard instead of inputInfo.pointer/keyboard.

Affected calls:
 ProcChangeKeyboardControl
 ProcBell
 ProcUngrabKey
 ProcUngrabButton
This commit is contained in:
Peter Hutterer 2009-03-13 14:59:18 +10:00
parent e31727158c
commit 18430616cf
2 changed files with 19 additions and 10 deletions

View File

@ -1824,13 +1824,16 @@ DoChangeKeyboardControl (ClientPtr client, DeviceIntPtr keybd, XID *vlist,
#undef DO_ALL #undef DO_ALL
} }
/**
* Changes kbd control on the ClientPointer and all attached SDs.
*/
int int
ProcChangeKeyboardControl (ClientPtr client) ProcChangeKeyboardControl (ClientPtr client)
{ {
XID *vlist; XID *vlist;
BITS32 vmask; BITS32 vmask;
int ret = Success, error = Success; int ret = Success, error = Success;
DeviceIntPtr pDev = NULL; DeviceIntPtr pDev = NULL, keyboard;
REQUEST(xChangeKeyboardControlReq); REQUEST(xChangeKeyboardControlReq);
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq); REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
@ -1841,8 +1844,10 @@ ProcChangeKeyboardControl (ClientPtr client)
if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask)) if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
return BadLength; return BadLength;
keyboard = PickKeyboard(client);
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && if ((pDev == keyboard || (!pDev->isMaster && pDev->u.master == keyboard)) &&
pDev->kbdfeed && pDev->kbdfeed->CtrlProc) { pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess); ret = XaceHook(XACE_DEVICE_ACCESS, client, pDev, DixManageAccess);
if (ret != Success) if (ret != Success)
@ -1851,7 +1856,7 @@ ProcChangeKeyboardControl (ClientPtr client)
} }
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && if ((pDev == keyboard || (!pDev->isMaster && pDev->u.master == keyboard)) &&
pDev->kbdfeed && pDev->kbdfeed->CtrlProc) { pDev->kbdfeed && pDev->kbdfeed->CtrlProc) {
ret = DoChangeKeyboardControl(client, pDev, vlist, vmask); ret = DoChangeKeyboardControl(client, pDev, vlist, vmask);
if (ret != Success) if (ret != Success)
@ -1893,7 +1898,7 @@ ProcGetKeyboardControl (ClientPtr client)
int int
ProcBell(ClientPtr client) ProcBell(ClientPtr client)
{ {
DeviceIntPtr keybd = PickKeyboard(client); DeviceIntPtr dev, keybd = PickKeyboard(client);
int base = keybd->kbdfeed->ctrl.bell; int base = keybd->kbdfeed->ctrl.bell;
int newpercent; int newpercent;
int rc; int rc;
@ -1920,14 +1925,14 @@ ProcBell(ClientPtr client)
newpercent = base - newpercent + stuff->percent; newpercent = base - newpercent + stuff->percent;
for (keybd = inputInfo.devices; keybd; keybd = keybd->next) { for (keybd = inputInfo.devices; keybd; keybd = keybd->next) {
if ((keybd->coreEvents || keybd == inputInfo.keyboard) && if ((dev == keybd || (!dev->isMaster && dev->u.master == keybd)) &&
keybd->kbdfeed && keybd->kbdfeed->BellProc) { keybd->kbdfeed && keybd->kbdfeed->BellProc) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixBellAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixBellAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
XkbHandleBell(FALSE, FALSE, keybd, newpercent, XkbHandleBell(FALSE, FALSE, keybd, newpercent,
&keybd->kbdfeed->ctrl, 0, None, NULL, client); &dev->kbdfeed->ctrl, 0, None, NULL, client);
} }
} }

View File

@ -4880,7 +4880,7 @@ ProcUngrabKey(ClientPtr client)
tempGrab.window = pWin; tempGrab.window = pWin;
tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.exact = stuff->modifiers;
tempGrab.modifiersDetail.pMask = NULL; tempGrab.modifiersDetail.pMask = NULL;
tempGrab.modifierDevice = inputInfo.keyboard; tempGrab.modifierDevice = GetPairedDevice(keybd);
tempGrab.type = KeyPress; tempGrab.type = KeyPress;
tempGrab.detail.exact = stuff->key; tempGrab.detail.exact = stuff->key;
tempGrab.detail.pMask = NULL; tempGrab.detail.pMask = NULL;
@ -5055,6 +5055,7 @@ ProcUngrabButton(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
GrabRec tempGrab; GrabRec tempGrab;
int rc; int rc;
DeviceIntPtr ptr;
REQUEST_SIZE_MATCH(xUngrabButtonReq); REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) && if ((stuff->modifiers != AnyModifier) &&
@ -5066,12 +5067,15 @@ ProcUngrabButton(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
ptr = PickPointer(client);
tempGrab.resource = client->clientAsMask; tempGrab.resource = client->clientAsMask;
tempGrab.device = PickPointer(client); tempGrab.device = ptr;
tempGrab.window = pWin; tempGrab.window = pWin;
tempGrab.modifiersDetail.exact = stuff->modifiers; tempGrab.modifiersDetail.exact = stuff->modifiers;
tempGrab.modifiersDetail.pMask = NULL; tempGrab.modifiersDetail.pMask = NULL;
tempGrab.modifierDevice = inputInfo.keyboard; tempGrab.modifierDevice = GetPairedDevice(ptr);
tempGrab.type = ButtonPress; tempGrab.type = ButtonPress;
tempGrab.detail.exact = stuff->button; tempGrab.detail.exact = stuff->button;
tempGrab.detail.pMask = NULL; tempGrab.detail.pMask = NULL;