Merge remote branch 'whot/for-keith'

This commit is contained in:
Keith Packard 2010-12-14 15:04:12 -08:00
commit f1542f1d71
3 changed files with 54 additions and 33 deletions

View File

@ -767,7 +767,7 @@ moveRelative(DeviceIntPtr dev, int *x, int *y, ValuatorMask *mask)
/* if attached, clip both x and y to the defined limits (usually /* if attached, clip both x and y to the defined limits (usually
* co-ord space limit). If it is attached, we need x/y to go over the * co-ord space limit). If it is attached, we need x/y to go over the
* limits to be able to change screens. */ * limits to be able to change screens. */
if(dev->u.master) { if(dev->u.master && dev->valuator) {
if (valuator_get_mode(dev, 0) == Absolute) if (valuator_get_mode(dev, 0) == Absolute)
clipAxis(dev, 0, x); clipAxis(dev, 0, x);
if (valuator_get_mode(dev, 1) == Absolute) if (valuator_get_mode(dev, 1) == Absolute)
@ -830,7 +830,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
int old_screenx, old_screeny; int old_screenx, old_screeny;
/* scale x&y to screen */ /* scale x&y to screen */
if (dev->valuator->numAxes > 0) { if (dev->valuator && dev->valuator->numAxes > 0) {
*screenx = rescaleValuatorAxis(*x, x_frac, screenx_frac, *screenx = rescaleValuatorAxis(*x, x_frac, screenx_frac,
dev->valuator->axes + 0, NULL, scr->width); dev->valuator->axes + 0, NULL, scr->width);
} else { } else {
@ -838,7 +838,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
*screenx_frac = dev->last.remainder[0]; *screenx_frac = dev->last.remainder[0];
} }
if (dev->valuator->numAxes > 1) { if (dev->valuator && dev->valuator->numAxes > 1) {
*screeny = rescaleValuatorAxis(*y, y_frac, screeny_frac, *screeny = rescaleValuatorAxis(*y, y_frac, screeny_frac,
dev->valuator->axes + 1, NULL, scr->height); dev->valuator->axes + 1, NULL, scr->height);
} else { } else {
@ -872,6 +872,8 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
dev->u.master->last.remainder[1] = *screeny_frac; dev->u.master->last.remainder[1] = *screeny_frac;
} }
if (dev->valuator)
{
/* Crossed screen? Scale back to device coordiantes */ /* Crossed screen? Scale back to device coordiantes */
if(*screenx != old_screenx) if(*screenx != old_screenx)
{ {
@ -885,6 +887,7 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
*y = rescaleValuatorAxis(*screeny, *screeny_frac, &y_frac, NULL, *y = rescaleValuatorAxis(*screeny, *screeny_frac, &y_frac, NULL,
dev->valuator->axes + 1, scr->height); dev->valuator->axes + 1, scr->height);
} }
}
/* dropy x/y (device coordinates) back into valuators for next event */ /* dropy x/y (device coordinates) back into valuators for next event */
dev->last.valuators[0] = *x; dev->last.valuators[0] = *x;
@ -904,6 +907,9 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
static void static void
updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms) updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
{ {
if (!dev->valuator)
return;
updateMotionHistory(dev, ms, mask, dev->last.valuators); updateMotionHistory(dev, ms, mask, dev->last.valuators);
if (dev->u.master) if (dev->u.master)
{ {
@ -1104,18 +1110,26 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
if (!pDev->enabled) if (!pDev->enabled)
return 0; return 0;
if (!scr)
return 0;
switch (type)
{
case MotionNotify:
if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)
return 0;
break;
case ButtonPress:
case ButtonRelease:
if (!pDev->button || !buttons)
return 0;
break;
default:
return 0;
}
ms = GetTimeInMillis(); /* before pointer update to help precision */ ms = GetTimeInMillis(); /* before pointer update to help precision */
if (!scr || !pDev->valuator ||
(type != MotionNotify && type != ButtonPress && type != ButtonRelease) ||
(type != MotionNotify && !pDev->button) ||
((type == ButtonPress || type == ButtonRelease) && !buttons))
return 0;
if (type == MotionNotify &&
(!mask_in || valuator_mask_num_valuators(mask_in) <= 0))
return 0;
events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events); events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events);
raw = (RawDeviceEvent*)events->event; raw = (RawDeviceEvent*)events->event;

View File

@ -130,7 +130,7 @@ xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
if (defaultOpts) { if (defaultOpts) {
XF86OptionPtr tmp =xf86optionListCreate(defaultOpts, -1, 0); XF86OptionPtr tmp =xf86optionListCreate(defaultOpts, -1, 0);
if (pInfo->options) if (pInfo->options)
pInfo->options = xf86optionListMerge(pInfo->options, tmp); pInfo->options = xf86optionListMerge(tmp, pInfo->options);
else else
pInfo->options = tmp; pInfo->options = tmp;
} }

View File

@ -684,6 +684,7 @@ xf86AddInput(InputDriverPtr drv, InputInfoPtr pInfo)
pInfo->next = NULL; pInfo->next = NULL;
xf86CollectInputOptions(pInfo, (const char**)drv->default_options); xf86CollectInputOptions(pInfo, (const char**)drv->default_options);
xf86OptionListReport(pInfo->options);
xf86ProcessCommonOptions(pInfo, pInfo->options); xf86ProcessCommonOptions(pInfo, pInfo->options);
} }
@ -1015,10 +1016,13 @@ xf86PostMotionEventM(DeviceIntPtr device,
int dx = 0, dy = 0; int dx = 0, dy = 0;
#endif #endif
if (valuator_mask_num_valuators(mask) > 0)
{
if (is_absolute) if (is_absolute)
flags = POINTER_ABSOLUTE; flags = POINTER_ABSOLUTE;
else else
flags = POINTER_RELATIVE | POINTER_ACCELERATE; flags = POINTER_RELATIVE | POINTER_ACCELERATE;
}
#if XFreeXDGA #if XFreeXDGA
/* The evdev driver may not always send all axes across. */ /* The evdev driver may not always send all axes across. */
@ -1160,10 +1164,13 @@ xf86PostButtonEventM(DeviceIntPtr device,
int index; int index;
#endif #endif
if (valuator_mask_num_valuators(mask) > 0)
{
if (is_absolute) if (is_absolute)
flags = POINTER_ABSOLUTE; flags = POINTER_ABSOLUTE;
else else
flags = POINTER_RELATIVE | POINTER_ACCELERATE; flags = POINTER_RELATIVE | POINTER_ACCELERATE;
}
#if XFreeXDGA #if XFreeXDGA
if (miPointerGetScreen(device)) { if (miPointerGetScreen(device)) {