summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-03-02 17:14:37 +1030
committerPeter Hutterer <whot@hyena.localdomain>2007-03-02 17:14:37 +1030
commit57aa5e908dc11d5d8c27ed705c526f1416c1e8ad (patch)
treed9abea38a8f47d671488c509f2e5808d233cabdb
parente43b8a4e40991ca6e545bda4cf9b9bd7a2bf22e2 (diff)
dix, Xext, Xtrap, Xi: replace inputInfo.pointer with PickPointer where
possible. More replacements to come.
-rw-r--r--XTrap/xtrapddmi.c4
-rw-r--r--Xext/xtest.c6
-rw-r--r--Xi/grabdevb.c2
-rw-r--r--Xi/grabdevk.c2
-rw-r--r--Xi/ungrdevb.c2
-rw-r--r--Xi/ungrdevk.c2
-rw-r--r--dix/devices.c29
7 files changed, 29 insertions, 18 deletions
diff --git a/XTrap/xtrapddmi.c b/XTrap/xtrapddmi.c
index c633b8d36..ec094ecf4 100644
--- a/XTrap/xtrapddmi.c
+++ b/XTrap/xtrapddmi.c
@@ -97,8 +97,8 @@ int XETrapSimulateXEvent(register xXTrapInputReq *request,
xEvent xev;
register int x = request->input.x;
register int y = request->input.y;
- DevicePtr keydev = LookupKeyboardDevice();
- DevicePtr ptrdev = LookupPointerDevice();
+ DevicePtr keydev = (DevicePtr)PickKeyboard(client);
+ DevicePtr ptrdev = (DevicePtr)PickPointer(client);
if (request->input.screen < screenInfo.numScreens)
{
diff --git a/Xext/xtest.c b/Xext/xtest.c
index cb7b5b83b..93e88c471 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -316,7 +316,7 @@ ProcXTestFakeInput(client)
#ifdef XINPUT
if (!extension)
#endif /* XINPUT */
- dev = (DeviceIntPtr)LookupKeyboardDevice();
+ dev = PickKeyboard(client);
if (ev->u.u.detail < dev->key->curKeySyms.minKeyCode ||
ev->u.u.detail > dev->key->curKeySyms.maxKeyCode)
{
@@ -361,7 +361,7 @@ ProcXTestFakeInput(client)
}
#endif /* XINPUT */
if (!dev)
- dev = (DeviceIntPtr*)LookupPointerDevice();
+ dev = PickPointer(client);
if (ev->u.keyButtonPointer.root == None)
root = GetCurrentRootWindow();
else
@@ -451,7 +451,7 @@ ProcXTestFakeInput(client)
#ifdef XINPUT
if (!extension)
#endif /* XINPUT */
- dev = (DeviceIntPtr*)LookupPointerDevice();
+ dev = PickPointer(client);
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
{
client->errorValue = ev->u.u.detail;
diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c
index 4333550f1..d79a36c8d 100644
--- a/Xi/grabdevb.c
+++ b/Xi/grabdevb.c
@@ -140,7 +140,7 @@ ProcXGrabDeviceButton(ClientPtr client)
return Success;
}
} else
- mdev = (DeviceIntPtr) LookupKeyboardDevice();
+ mdev = PickKeyboard(client);
class = (XEventClass *) (&stuff[1]); /* first word of values */
diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c
index 71e72d56f..1120149d3 100644
--- a/Xi/grabdevk.c
+++ b/Xi/grabdevk.c
@@ -137,7 +137,7 @@ ProcXGrabDeviceKey(ClientPtr client)
return Success;
}
} else
- mdev = (DeviceIntPtr) LookupKeyboardDevice();
+ mdev = PickKeyboard(client);
class = (XEventClass *) (&stuff[1]); /* first word of values */
diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c
index 8db9307ce..b75916f42 100644
--- a/Xi/ungrdevb.c
+++ b/Xi/ungrdevb.c
@@ -133,7 +133,7 @@ ProcXUngrabDeviceButton(ClientPtr client)
return Success;
}
} else
- mdev = (DeviceIntPtr) LookupKeyboardDevice();
+ mdev = PickKeyboard(client);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c
index ebb83bce7..e8c006ae6 100644
--- a/Xi/ungrdevk.c
+++ b/Xi/ungrdevk.c
@@ -132,7 +132,7 @@ ProcXUngrabDeviceKey(ClientPtr client)
return Success;
}
} else
- mdev = (DeviceIntPtr) LookupKeyboardDevice();
+ mdev = PickKeyboard(client);
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess);
if (rc != Success) {
diff --git a/dix/devices.c b/dix/devices.c
index f053e3401..87b3927f9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -597,6 +597,8 @@ RemoveDevice(DeviceIntPtr dev)
int
NumMotionEvents()
{
+ /* only called to fill data in initial connection reply.
+ * VCP is ok here, it is the only fixed device we have. */
return inputInfo.pointer->valuator->numMotionEvents;
}
@@ -1376,6 +1378,7 @@ ProcSetPointerMapping(ClientPtr client)
REQUEST(xSetPointerMappingReq);
BYTE *map;
int ret;
+ DeviceIntPtr ptr = PickPointer(client);
xSetPointerMappingReply rep;
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
@@ -1389,14 +1392,18 @@ ProcSetPointerMapping(ClientPtr client)
/* So we're bounded here by the number of core buttons. This check
* probably wants disabling through XFixes. */
- if (stuff->nElts != inputInfo.pointer->button->numButtons) {
+ /* MPX: With ClientPointer, we can return the right number of buttons.
+ * Let's just hope nobody changed ClientPointer between GetPointerMapping
+ * and SetPointerMapping
+ */
+ if (stuff->nElts != ptr->button->numButtons) {
client->errorValue = stuff->nElts;
return BadValue;
}
if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue))
return BadValue;
- ret = DoSetPointerMapping(inputInfo.pointer, map, stuff->nElts);
+ ret = DoSetPointerMapping(ptr, map, stuff->nElts);
if (ret != Success) {
rep.success = ret;
WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
@@ -1404,7 +1411,7 @@ ProcSetPointerMapping(ClientPtr client)
}
/* FIXME: Send mapping notifies for all the extended devices as well. */
- SendMappingNotify(inputInfo.pointer, MappingPointer, 0, 0, client);
+ SendMappingNotify(ptr, MappingPointer, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
return Success;
}
@@ -1414,7 +1421,8 @@ ProcGetKeyboardMapping(ClientPtr client)
{
xGetKeyboardMappingReply rep;
REQUEST(xGetKeyboardMappingReq);
- KeySymsPtr curKeySyms = &inputInfo.keyboard->key->curKeySyms;
+ DeviceIntPtr kbd = PickKeyboard(client);
+ KeySymsPtr curKeySyms = &kbd->key->curKeySyms;
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
@@ -1449,7 +1457,9 @@ int
ProcGetPointerMapping(ClientPtr client)
{
xGetPointerMappingReply rep;
- ButtonClassPtr butc = inputInfo.pointer->button;
+ /* Apps may get different values each time they call GetPointerMapping as
+ * the ClientPointer could change. */
+ ButtonClassPtr butc = PickPointer(client)->button;
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
@@ -1753,7 +1763,7 @@ ProcBell(ClientPtr client)
int
ProcChangePointerControl(ClientPtr client)
{
- DeviceIntPtr mouse = inputInfo.pointer;
+ DeviceIntPtr mouse = PickPointer(client);
PtrCtrl ctrl; /* might get BadValue part way through */
REQUEST(xChangePointerControlReq);
@@ -1809,7 +1819,7 @@ ProcChangePointerControl(ClientPtr client)
for (mouse = inputInfo.devices; mouse; mouse = mouse->next) {
- if ((mouse->coreEvents || mouse == inputInfo.pointer) &&
+ if ((mouse->coreEvents || mouse == PickPointer(client)) &&
mouse->ptrfeed && mouse->ptrfeed->CtrlProc) {
mouse->ptrfeed->ctrl = ctrl;
(*mouse->ptrfeed->CtrlProc)(mouse, &mouse->ptrfeed->ctrl);
@@ -1822,7 +1832,8 @@ ProcChangePointerControl(ClientPtr client)
int
ProcGetPointerControl(ClientPtr client)
{
- register PtrCtrl *ctrl = &inputInfo.pointer->ptrfeed->ctrl;
+ DeviceIntPtr ptr = PickPointer(client);
+ PtrCtrl *ctrl = &ptr->ptrfeed->ctrl;
xGetPointerControlReply rep;
REQUEST_SIZE_MATCH(xReq);
@@ -1860,7 +1871,7 @@ ProcGetMotionEvents(ClientPtr client)
xGetMotionEventsReply rep;
int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents;
- DeviceIntPtr mouse = inputInfo.pointer;
+ DeviceIntPtr mouse = PickPointer(client);
TimeStamp start, stop;
REQUEST(xGetMotionEventsReq);