fix: WarpCursor needs to send MotionNotify.
This commit is contained in:
parent
81aa7f059d
commit
d570ff7c81
|
@ -489,6 +489,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
|
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
|
||||||
DeviceIntPtr cp = inputInfo.pointer;
|
DeviceIntPtr cp = inputInfo.pointer;
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
|
Bool coreOnly = (pDev == inputInfo.pointer);
|
||||||
|
|
||||||
/* Sanity checks. */
|
/* Sanity checks. */
|
||||||
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
|
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
|
||||||
|
@ -497,7 +498,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
|
if ((type == ButtonPress || type == ButtonRelease) && !pDev->button)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (pDev->coreEvents)
|
if (!coreOnly && pDev->coreEvents)
|
||||||
num_events = 2;
|
num_events = 2;
|
||||||
else
|
else
|
||||||
num_events = 1;
|
num_events = 1;
|
||||||
|
@ -507,7 +508,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we need to send a DeviceValuator event? */
|
/* Do we need to send a DeviceValuator event? */
|
||||||
if (sendValuators) {
|
if (!coreOnly && sendValuators) {
|
||||||
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
|
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
|
||||||
num_valuators = MAX_VALUATOR_EVENTS * 6;
|
num_valuators = MAX_VALUATOR_EVENTS * 6;
|
||||||
num_events += ((num_valuators - 1) / 6) + 1;
|
num_events += ((num_valuators - 1) / 6) + 1;
|
||||||
|
@ -521,10 +522,6 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
|
|
||||||
ms = GetTimeInMillis();
|
ms = GetTimeInMillis();
|
||||||
|
|
||||||
kbp = (deviceKeyButtonPointer *) events;
|
|
||||||
kbp->time = ms;
|
|
||||||
kbp->deviceid = pDev->id;
|
|
||||||
|
|
||||||
/* Set x and y based on whether this is absolute or relative, and
|
/* Set x and y based on whether this is absolute or relative, and
|
||||||
* accelerate if we need to. */
|
* accelerate if we need to. */
|
||||||
if (flags & POINTER_ABSOLUTE) {
|
if (flags & POINTER_ABSOLUTE) {
|
||||||
|
@ -602,29 +599,37 @@ 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) {
|
if (!coreOnly)
|
||||||
kbp->type = DeviceMotionNotify;
|
{
|
||||||
}
|
kbp = (deviceKeyButtonPointer *) events;
|
||||||
else {
|
kbp->time = ms;
|
||||||
if (type == ButtonPress)
|
kbp->deviceid = pDev->id;
|
||||||
kbp->type = DeviceButtonPress;
|
|
||||||
else if (type == ButtonRelease)
|
if (type == MotionNotify) {
|
||||||
kbp->type = DeviceButtonRelease;
|
kbp->type = DeviceMotionNotify;
|
||||||
kbp->detail = pDev->button->map[buttons];
|
}
|
||||||
|
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;
|
||||||
|
clipValuators(pDev, first_valuator, num_valuators, valuators);
|
||||||
|
events = getValuatorEvents(events, pDev, first_valuator,
|
||||||
|
num_valuators, valuators);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kbp->root_x = x;
|
/* for some reason inputInfo.pointer does not have coreEvents set */
|
||||||
kbp->root_y = y;
|
if (coreOnly || pDev->coreEvents) {
|
||||||
|
|
||||||
events++;
|
|
||||||
if (sendValuators) {
|
|
||||||
kbp->deviceid |= MORE_EVENTS;
|
|
||||||
clipValuators(pDev, first_valuator, num_valuators, valuators);
|
|
||||||
events = getValuatorEvents(events, pDev, first_valuator,
|
|
||||||
num_valuators, valuators);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pDev->coreEvents) {
|
|
||||||
events->u.u.type = type;
|
events->u.u.type = type;
|
||||||
events->u.keyButtonPointer.time = ms;
|
events->u.keyButtonPointer.time = ms;
|
||||||
events->u.keyButtonPointer.rootX = x;
|
events->u.keyButtonPointer.rootX = x;
|
||||||
|
|
|
@ -474,6 +474,10 @@ void
|
||||||
miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
|
miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
|
||||||
unsigned long time)
|
unsigned long time)
|
||||||
{
|
{
|
||||||
|
xEvent* events;
|
||||||
|
int i, nevents;
|
||||||
|
int valuators[2];
|
||||||
|
|
||||||
SetupScreen(pScreen);
|
SetupScreen(pScreen);
|
||||||
|
|
||||||
if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
|
if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
|
||||||
|
@ -488,4 +492,23 @@ miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
|
||||||
miPointer.x = x;
|
miPointer.x = x;
|
||||||
miPointer.y = y;
|
miPointer.y = y;
|
||||||
miPointer.pScreen = pScreen;
|
miPointer.pScreen = pScreen;
|
||||||
|
|
||||||
|
/* generate motion notify */
|
||||||
|
valuators[0] = x;
|
||||||
|
valuators[1] = y;
|
||||||
|
|
||||||
|
events = (xEvent*)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
||||||
|
if (!events)
|
||||||
|
{
|
||||||
|
FatalError("Could not allocate event store.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nevents = GetPointerEvents(events, pDev, MotionNotify, 0,
|
||||||
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
|
||||||
|
for (i = 0; i < nevents; i++)
|
||||||
|
mieqEnqueue(pDev, &events[i]);
|
||||||
|
|
||||||
|
xfree(events);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue