dix: Clean up GetPointerEvents. If pDev == inputInfo.pointer, assume that

we do not want Xi events.

mi:     Remove POINTER_CORE_ONLY flag.
This commit is contained in:
Peter Hutterer 2007-02-14 11:18:43 +10:30 committed by Peter Hutterer
parent 7cd73b00a2
commit 33ef546b94
3 changed files with 22 additions and 31 deletions

View File

@ -482,8 +482,6 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*
* If flag has POINTER_CORE_ONLY set, no XI or valuator event will be
* generated.
*/
_X_EXPORT int
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
@ -497,7 +495,8 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr pointer = NULL;
int x = 0, y = 0;
Bool coreOnly = (flags & POINTER_CORE_ONLY);
/* The core pointer must not send Xi events. */
Bool coreOnly = (pDev == inputInfo.pointer);
/* Sanity checks. */
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
@ -530,10 +529,6 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
ms = GetTimeInMillis();
kbp = (deviceKeyButtonPointer *) events;
kbp->time = ms;
kbp->deviceid = pDev->id;
if (!pDev->coreEvents || pDev->isMPDev)
pointer = pDev;
else
@ -598,22 +593,27 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
pDev->valuator->lastx = x;
pDev->valuator->lasty = y;
if (type == MotionNotify) {
kbp->type = DeviceMotionNotify;
}
else {
if (type == ButtonPress)
kbp->type = DeviceButtonPress;
else if (type == ButtonRelease)
kbp->type = DeviceButtonRelease;
kbp->detail = pDev->button->map[buttons];
}
kbp->root_x = x;
kbp->root_y = y;
/* create Xi event */
if (!coreOnly)
{
kbp = (deviceKeyButtonPointer *) events;
kbp->time = ms;
kbp->deviceid = pDev->id;
if (type == MotionNotify) {
kbp->type = DeviceMotionNotify;
}
else {
if (type == ButtonPress)
kbp->type = DeviceButtonPress;
else if (type == ButtonRelease)
kbp->type = DeviceButtonRelease;
kbp->detail = pDev->button->map[buttons];
}
kbp->root_x = x;
kbp->root_y = y;
events++;
if (sendValuators) {
kbp->deviceid |= MORE_EVENTS;

View File

@ -62,7 +62,6 @@ SOFTWARE.
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
#define POINTER_ACCELERATE (1 << 3)
#define POINTER_CORE_ONLY (1 << 4) /* do not generate XI event */
#define MAP_LENGTH 256
#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */

View File

@ -543,7 +543,6 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
xEvent* events;
int i, nevents;
int valuators[2];
int flags;
miPointerPtr pPointer = MIPOINTER(pDev);
SetupScreen(pScreen);
@ -571,15 +570,8 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
return;
}
flags = POINTER_ABSOLUTE;
/* If called from ProcWarpCursor, pDev is the VCP and we must not generate
an XI event. */
if (pDev == inputInfo.pointer)
flags |= POINTER_CORE_ONLY;
nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
flags, 0, 2, valuators);
POINTER_ABSOLUTE, 0, 2, valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(pDev, &events[i]);