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:
parent
7cd73b00a2
commit
33ef546b94
|
@ -482,8 +482,6 @@ GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
|
||||||
* The DDX is responsible for allocating the event structure in the first
|
* The DDX is responsible for allocating the event structure in the first
|
||||||
* place via GetMaximumEventsNum(), and for freeing it.
|
* 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
|
_X_EXPORT int
|
||||||
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
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);
|
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
|
||||||
DeviceIntPtr pointer = NULL;
|
DeviceIntPtr pointer = NULL;
|
||||||
int x = 0, y = 0;
|
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. */
|
/* Sanity checks. */
|
||||||
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
|
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
|
||||||
|
@ -530,10 +529,6 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
|
|
||||||
ms = GetTimeInMillis();
|
ms = GetTimeInMillis();
|
||||||
|
|
||||||
kbp = (deviceKeyButtonPointer *) events;
|
|
||||||
kbp->time = ms;
|
|
||||||
kbp->deviceid = pDev->id;
|
|
||||||
|
|
||||||
if (!pDev->coreEvents || pDev->isMPDev)
|
if (!pDev->coreEvents || pDev->isMPDev)
|
||||||
pointer = pDev;
|
pointer = pDev;
|
||||||
else
|
else
|
||||||
|
@ -598,22 +593,27 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
pDev->valuator->lastx = x;
|
pDev->valuator->lastx = x;
|
||||||
pDev->valuator->lasty = y;
|
pDev->valuator->lasty = y;
|
||||||
|
|
||||||
if (type == MotionNotify) {
|
/* create Xi event */
|
||||||
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;
|
|
||||||
|
|
||||||
if (!coreOnly)
|
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++;
|
events++;
|
||||||
if (sendValuators) {
|
if (sendValuators) {
|
||||||
kbp->deviceid |= MORE_EVENTS;
|
kbp->deviceid |= MORE_EVENTS;
|
||||||
|
|
|
@ -62,7 +62,6 @@ SOFTWARE.
|
||||||
#define POINTER_RELATIVE (1 << 1)
|
#define POINTER_RELATIVE (1 << 1)
|
||||||
#define POINTER_ABSOLUTE (1 << 2)
|
#define POINTER_ABSOLUTE (1 << 2)
|
||||||
#define POINTER_ACCELERATE (1 << 3)
|
#define POINTER_ACCELERATE (1 << 3)
|
||||||
#define POINTER_CORE_ONLY (1 << 4) /* do not generate XI event */
|
|
||||||
|
|
||||||
#define MAP_LENGTH 256
|
#define MAP_LENGTH 256
|
||||||
#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
|
#define DOWN_LENGTH 32 /* 256/8 => number of bytes to hold 256 bits */
|
||||||
|
|
|
@ -543,7 +543,6 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
|
||||||
xEvent* events;
|
xEvent* events;
|
||||||
int i, nevents;
|
int i, nevents;
|
||||||
int valuators[2];
|
int valuators[2];
|
||||||
int flags;
|
|
||||||
miPointerPtr pPointer = MIPOINTER(pDev);
|
miPointerPtr pPointer = MIPOINTER(pDev);
|
||||||
SetupScreen(pScreen);
|
SetupScreen(pScreen);
|
||||||
|
|
||||||
|
@ -571,15 +570,8 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
|
||||||
return;
|
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,
|
nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
|
||||||
flags, 0, 2, valuators);
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
|
||||||
for (i = 0; i < nevents; i++)
|
for (i = 0; i < nevents; i++)
|
||||||
mieqEnqueue(pDev, &events[i]);
|
mieqEnqueue(pDev, &events[i]);
|
||||||
|
|
Loading…
Reference in New Issue