Merge remote branch 'whot/for-keith'
This commit is contained in:
commit
c3c0e2fdd3
|
@ -191,7 +191,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
info->status = status;
|
info->status = status;
|
||||||
info->modifiers = *modifiers;
|
info->modifiers = *modifiers;
|
||||||
rep.num_modifiers++;
|
rep.num_modifiers++;
|
||||||
rep.length++;
|
rep.length += bytes_to_int32(sizeof(xXIGrabModifierInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
if (rep.num_modifiers)
|
if (rep.num_modifiers)
|
||||||
{
|
{
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, rep.num_modifiers * 4, (char*)modifiers_failed);
|
WriteSwappedDataToClient(client, rep.length * 4, (char*)modifiers_failed);
|
||||||
}
|
}
|
||||||
free(modifiers_failed);
|
free(modifiers_failed);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1051,11 +1051,11 @@ SProcXChangeDeviceProperty (ClientPtr client)
|
||||||
char n;
|
char n;
|
||||||
REQUEST(xChangeDevicePropertyReq);
|
REQUEST(xChangeDevicePropertyReq);
|
||||||
|
|
||||||
|
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
swapl(&stuff->property, n);
|
swapl(&stuff->property, n);
|
||||||
swapl(&stuff->type, n);
|
swapl(&stuff->type, n);
|
||||||
swapl(&stuff->nUnits, n);
|
swapl(&stuff->nUnits, n);
|
||||||
REQUEST_SIZE_MATCH(xChangeDevicePropertyReq);
|
|
||||||
return (ProcXChangeDeviceProperty(client));
|
return (ProcXChangeDeviceProperty(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,12 +1295,12 @@ SProcXIChangeProperty(ClientPtr client)
|
||||||
char n;
|
char n;
|
||||||
REQUEST(xXIChangePropertyReq);
|
REQUEST(xXIChangePropertyReq);
|
||||||
|
|
||||||
|
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
|
||||||
swaps(&stuff->length, n);
|
swaps(&stuff->length, n);
|
||||||
swaps(&stuff->deviceid, n);
|
swaps(&stuff->deviceid, n);
|
||||||
swapl(&stuff->property, n);
|
swapl(&stuff->property, n);
|
||||||
swapl(&stuff->type, n);
|
swapl(&stuff->type, n);
|
||||||
swapl(&stuff->num_items, n);
|
swapl(&stuff->num_items, n);
|
||||||
REQUEST_SIZE_MATCH(xXIChangePropertyReq);
|
|
||||||
return (ProcXIChangeProperty(client));
|
return (ProcXIChangeProperty(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,10 +392,10 @@ unwind:
|
||||||
free(driver);
|
free(driver);
|
||||||
free(name);
|
free(name);
|
||||||
free(config_info);
|
free(config_info);
|
||||||
while (!dev && (tmpo = options)) {
|
while ((tmpo = options)) {
|
||||||
options = tmpo->next;
|
options = tmpo->next;
|
||||||
free(tmpo->key);
|
free(tmpo->key); /* NULL if dev != NULL */
|
||||||
free(tmpo->value);
|
free(tmpo->value); /* NULL if dev != NULL */
|
||||||
free(tmpo);
|
free(tmpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,10 +197,10 @@ device_added(struct udev_device *udev_device)
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
free(config_info);
|
free(config_info);
|
||||||
while (!dev && (tmpo = options)) {
|
while ((tmpo = options)) {
|
||||||
options = tmpo->next;
|
options = tmpo->next;
|
||||||
free(tmpo->key);
|
free(tmpo->key); /* NULL if dev != NULL */
|
||||||
free(tmpo->value);
|
free(tmpo->value); /* NULL if dev != NULL */
|
||||||
free(tmpo);
|
free(tmpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -938,6 +938,8 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dev->deviceGrab.sync.event);
|
free(dev->deviceGrab.sync.event);
|
||||||
|
free(dev->config_info); /* Allocated in xf86ActivateDevice. */
|
||||||
|
dev->config_info = NULL;
|
||||||
dixFreeObjectWithPrivates(dev, PRIVATE_DEVICE);
|
dixFreeObjectWithPrivates(dev, PRIVATE_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,9 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
||||||
case ET_ProximityOut:
|
case ET_ProximityOut:
|
||||||
*count = 0;
|
*count = 0;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
|
default:
|
||||||
|
*count = 0;
|
||||||
|
return BadImplementation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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->valuator && IsMaster(dev) || !IsFloating(dev)) {
|
if (dev->valuator && (IsMaster(dev) || !IsFloating(dev))) {
|
||||||
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)
|
||||||
|
@ -791,17 +791,14 @@ moveRelative(DeviceIntPtr dev, int *x, int *y, ValuatorMask *mask)
|
||||||
* Accelerate the data in valuators based on the device's acceleration scheme.
|
* Accelerate the data in valuators based on the device's acceleration scheme.
|
||||||
*
|
*
|
||||||
* @param dev The device which's pointer is to be moved.
|
* @param dev The device which's pointer is to be moved.
|
||||||
* @param first The first valuator in @valuators
|
* @param valuators Valuator mask
|
||||||
* @param num Total number of valuators in @valuators.
|
|
||||||
* @param valuators Valuator data for each axis between @first and
|
|
||||||
* @first+@num.
|
|
||||||
* @param ms Current time.
|
* @param ms Current time.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
accelPointer(DeviceIntPtr dev, int first, int num, int *valuators, CARD32 ms)
|
accelPointer(DeviceIntPtr dev, ValuatorMask* valuators, CARD32 ms)
|
||||||
{
|
{
|
||||||
if (dev->valuator->accelScheme.AccelSchemeProc)
|
if (dev->valuator->accelScheme.AccelSchemeProc)
|
||||||
dev->valuator->accelScheme.AccelSchemeProc(dev, first, num, valuators, ms);
|
dev->valuator->accelScheme.AccelSchemeProc(dev, valuators, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1170,20 +1167,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
|
||||||
moveAbsolute(pDev, &x, &y, &mask);
|
moveAbsolute(pDev, &x, &y, &mask);
|
||||||
} else {
|
} else {
|
||||||
if (flags & POINTER_ACCELERATE) {
|
if (flags & POINTER_ACCELERATE) {
|
||||||
/* FIXME: Pointer acceleration only requires X and Y values. This
|
accelPointer(pDev, &mask, ms);
|
||||||
* should be converted to masked valuators. */
|
|
||||||
int vals[2];
|
|
||||||
vals[0] = valuator_mask_isset(&mask, 0) ?
|
|
||||||
valuator_mask_get(&mask, 0) : 0;
|
|
||||||
vals[1] = valuator_mask_isset(&mask, 1) ?
|
|
||||||
valuator_mask_get(&mask, 1) : 0;
|
|
||||||
accelPointer(pDev, 0, 2, vals, ms);
|
|
||||||
|
|
||||||
if (valuator_mask_isset(&mask, 0))
|
|
||||||
valuator_mask_set(&mask, 0, vals[0]);
|
|
||||||
if (valuator_mask_isset(&mask, 1))
|
|
||||||
valuator_mask_set(&mask, 1, vals[1]);
|
|
||||||
|
|
||||||
/* The pointer acceleration code modifies the fractional part
|
/* The pointer acceleration code modifies the fractional part
|
||||||
* in-place, so we need to extract this information first */
|
* in-place, so we need to extract this information first */
|
||||||
x_frac = pDev->last.remainder[0];
|
x_frac = pDev->last.remainder[0];
|
||||||
|
|
217
dix/ptrveloc.c
217
dix/ptrveloc.c
|
@ -30,6 +30,7 @@
|
||||||
#include <ptrveloc.h>
|
#include <ptrveloc.h>
|
||||||
#include <exevents.h>
|
#include <exevents.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
#include <os.h>
|
||||||
|
|
||||||
#include <xserver-properties.h>
|
#include <xserver-properties.h>
|
||||||
|
|
||||||
|
@ -68,9 +69,12 @@ SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, float velocity,
|
||||||
static PointerAccelerationProfileFunc
|
static PointerAccelerationProfileFunc
|
||||||
GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
||||||
static BOOL
|
static BOOL
|
||||||
InitializePredictableAccelerationProperties(DeviceIntPtr dev);
|
InitializePredictableAccelerationProperties(DeviceIntPtr,
|
||||||
|
DeviceVelocityPtr,
|
||||||
|
PredictableAccelSchemePtr);
|
||||||
static BOOL
|
static BOOL
|
||||||
DeletePredictableAccelerationProperties(DeviceIntPtr dev);
|
DeletePredictableAccelerationProperties(DeviceIntPtr,
|
||||||
|
PredictableAccelSchemePtr);
|
||||||
|
|
||||||
/*#define PTRACCEL_DEBUGGING*/
|
/*#define PTRACCEL_DEBUGGING*/
|
||||||
|
|
||||||
|
@ -87,7 +91,6 @@ DeletePredictableAccelerationProperties(DeviceIntPtr dev);
|
||||||
/* some int which is not a profile number */
|
/* some int which is not a profile number */
|
||||||
#define PROFILE_UNINITIALIZE (-100)
|
#define PROFILE_UNINITIALIZE (-100)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init DeviceVelocity struct so it should match the average case
|
* Init DeviceVelocity struct so it should match the average case
|
||||||
*/
|
*/
|
||||||
|
@ -125,17 +128,22 @@ FreeVelocityData(DeviceVelocityPtr vel){
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
InitPredictableAccelerationScheme(DeviceIntPtr dev,
|
InitPredictableAccelerationScheme(DeviceIntPtr dev,
|
||||||
ValuatorAccelerationPtr protoScheme) {
|
ValuatorAccelerationPtr protoScheme) {
|
||||||
DeviceVelocityPtr vel;
|
DeviceVelocityPtr vel;
|
||||||
ValuatorAccelerationRec scheme;
|
ValuatorAccelerationRec scheme;
|
||||||
|
PredictableAccelSchemePtr schemeData;
|
||||||
scheme = *protoScheme;
|
scheme = *protoScheme;
|
||||||
vel = calloc(1, sizeof(DeviceVelocityRec));
|
vel = calloc(1, sizeof(DeviceVelocityRec));
|
||||||
if (!vel)
|
schemeData = calloc(1, sizeof(PredictableAccelSchemeRec));
|
||||||
return FALSE;
|
if (!vel || !schemeData)
|
||||||
|
return FALSE;
|
||||||
InitVelocityData(vel);
|
InitVelocityData(vel);
|
||||||
scheme.accelData = vel;
|
schemeData->vel = vel;
|
||||||
|
scheme.accelData = schemeData;
|
||||||
|
if (!InitializePredictableAccelerationProperties(dev, vel, schemeData))
|
||||||
|
return FALSE;
|
||||||
|
/* all fine, assign scheme to device */
|
||||||
dev->valuator->accelScheme = scheme;
|
dev->valuator->accelScheme = scheme;
|
||||||
InitializePredictableAccelerationProperties(dev);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,14 +154,21 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
|
||||||
void
|
void
|
||||||
AccelerationDefaultCleanup(DeviceIntPtr dev)
|
AccelerationDefaultCleanup(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
/*sanity check*/
|
DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
|
||||||
if( dev->valuator->accelScheme.AccelSchemeProc == acceleratePointerPredictable
|
if (vel) {
|
||||||
&& dev->valuator->accelScheme.accelData != NULL){
|
/* the proper guarantee would be that we're not inside of
|
||||||
|
* AccelSchemeProc(), but that seems impossible. Schemes don't get
|
||||||
|
* switched often anyway.
|
||||||
|
*/
|
||||||
|
OsBlockSignals();
|
||||||
dev->valuator->accelScheme.AccelSchemeProc = NULL;
|
dev->valuator->accelScheme.AccelSchemeProc = NULL;
|
||||||
FreeVelocityData(dev->valuator->accelScheme.accelData);
|
FreeVelocityData(vel);
|
||||||
|
free(vel);
|
||||||
|
DeletePredictableAccelerationProperties(dev,
|
||||||
|
(PredictableAccelSchemePtr) dev->valuator->accelScheme.accelData);
|
||||||
free(dev->valuator->accelScheme.accelData);
|
free(dev->valuator->accelScheme.accelData);
|
||||||
dev->valuator->accelScheme.accelData = NULL;
|
dev->valuator->accelScheme.accelData = NULL;
|
||||||
DeletePredictableAccelerationProperties(dev);
|
OsReleaseSignals();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,26 +360,34 @@ AccelInitScaleProperty(DeviceIntPtr dev, DeviceVelocityPtr vel)
|
||||||
return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
|
return XIRegisterPropertyHandler(dev, AccelSetScaleProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
static BOOL
|
||||||
InitializePredictableAccelerationProperties(DeviceIntPtr dev)
|
InitializePredictableAccelerationProperties(
|
||||||
|
DeviceIntPtr dev,
|
||||||
|
DeviceVelocityPtr vel,
|
||||||
|
PredictableAccelSchemePtr schemeData)
|
||||||
{
|
{
|
||||||
DeviceVelocityPtr vel = GetDevicePredictableAccelData(dev);
|
int num_handlers = 4;
|
||||||
|
|
||||||
if(!vel)
|
if(!vel)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
vel->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
|
schemeData->prop_handlers = calloc(num_handlers, sizeof(long));
|
||||||
vel->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
|
if (!schemeData->prop_handlers)
|
||||||
vel->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
|
return FALSE;
|
||||||
vel->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
|
schemeData->num_prop_handlers = num_handlers;
|
||||||
|
schemeData->prop_handlers[0] = AccelInitProfileProperty(dev, vel);
|
||||||
|
schemeData->prop_handlers[1] = AccelInitDecelProperty(dev, vel);
|
||||||
|
schemeData->prop_handlers[2] = AccelInitAdaptDecelProperty(dev, vel);
|
||||||
|
schemeData->prop_handlers[3] = AccelInitScaleProperty(dev, vel);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
DeletePredictableAccelerationProperties(DeviceIntPtr dev)
|
DeletePredictableAccelerationProperties(
|
||||||
|
DeviceIntPtr dev,
|
||||||
|
PredictableAccelSchemePtr scheme)
|
||||||
{
|
{
|
||||||
DeviceVelocityPtr vel;
|
DeviceVelocityPtr vel;
|
||||||
Atom prop;
|
Atom prop;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -378,10 +401,15 @@ DeletePredictableAccelerationProperties(DeviceIntPtr dev)
|
||||||
XIDeleteDeviceProperty(dev, prop, FALSE);
|
XIDeleteDeviceProperty(dev, prop, FALSE);
|
||||||
|
|
||||||
vel = GetDevicePredictableAccelData(dev);
|
vel = GetDevicePredictableAccelData(dev);
|
||||||
for (i = 0; vel && i < NPROPS_PREDICTABLE_ACCEL; i++)
|
if (vel) {
|
||||||
if (vel->prop_handlers[i])
|
for (i = 0; i < scheme->num_prop_handlers; i++)
|
||||||
XIUnregisterPropertyHandler(dev, vel->prop_handlers[i]);
|
if (scheme->prop_handlers[i])
|
||||||
|
XIUnregisterPropertyHandler(dev, scheme->prop_handlers[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(scheme->prop_handlers);
|
||||||
|
scheme->prop_handlers = NULL;
|
||||||
|
scheme->num_prop_handlers = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,8 +425,7 @@ InitTrackers(DeviceVelocityPtr vel, int ntracker)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(vel->tracker);
|
free(vel->tracker);
|
||||||
vel->tracker = (MotionTrackerPtr)malloc(ntracker * sizeof(MotionTracker));
|
vel->tracker = (MotionTrackerPtr)calloc(ntracker, sizeof(MotionTracker));
|
||||||
memset(vel->tracker, 0, ntracker * sizeof(MotionTracker));
|
|
||||||
vel->num_tracker = ntracker;
|
vel->num_tracker = ntracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1053,8 @@ GetDevicePredictableAccelData(
|
||||||
acceleratePointerPredictable &&
|
acceleratePointerPredictable &&
|
||||||
dev->valuator->accelScheme.accelData != NULL){
|
dev->valuator->accelScheme.accelData != NULL){
|
||||||
|
|
||||||
return (DeviceVelocityPtr)dev->valuator->accelScheme.accelData;
|
return ((PredictableAccelSchemePtr)
|
||||||
|
dev->valuator->accelScheme.accelData)->vel;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1043,32 +1071,28 @@ GetDevicePredictableAccelData(
|
||||||
void
|
void
|
||||||
acceleratePointerPredictable(
|
acceleratePointerPredictable(
|
||||||
DeviceIntPtr dev,
|
DeviceIntPtr dev,
|
||||||
int first_valuator,
|
ValuatorMask* val,
|
||||||
int num_valuators,
|
CARD32 evtime)
|
||||||
int *valuators,
|
|
||||||
int evtime)
|
|
||||||
{
|
{
|
||||||
float fdx, fdy, tmp, mult; /* no need to init */
|
float fdx, fdy, tmp, mult; /* no need to init */
|
||||||
int dx = 0, dy = 0;
|
int dx = 0, dy = 0, tmpi;
|
||||||
int *px = NULL, *py = NULL;
|
|
||||||
DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
|
DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
|
||||||
Bool soften = TRUE;
|
Bool soften = TRUE;
|
||||||
|
|
||||||
if (!num_valuators || !valuators || !velocitydata)
|
if (!velocitydata)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (velocitydata->statistics.profile_number == AccelProfileNone &&
|
if (velocitydata->statistics.profile_number == AccelProfileNone &&
|
||||||
velocitydata->const_acceleration == 1.0f) {
|
velocitydata->const_acceleration == 1.0f) {
|
||||||
return; /*we're inactive anyway, so skip the whole thing.*/
|
return; /*we're inactive anyway, so skip the whole thing.*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first_valuator == 0) {
|
if (valuator_mask_isset(val, 0)) {
|
||||||
dx = valuators[0];
|
dx = valuator_mask_get(val, 0);
|
||||||
px = &valuators[0];
|
|
||||||
}
|
}
|
||||||
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
|
|
||||||
dy = valuators[1 - first_valuator];
|
if (valuator_mask_isset(val, 1)) {
|
||||||
py = &valuators[1 - first_valuator];
|
dy = valuator_mask_get(val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dx || dy){
|
if (dx || dy){
|
||||||
|
@ -1080,15 +1104,15 @@ acceleratePointerPredictable(
|
||||||
if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
|
if (dev->ptrfeed && dev->ptrfeed->ctrl.num) {
|
||||||
/* invoke acceleration profile to determine acceleration */
|
/* invoke acceleration profile to determine acceleration */
|
||||||
mult = ComputeAcceleration (dev, velocitydata,
|
mult = ComputeAcceleration (dev, velocitydata,
|
||||||
dev->ptrfeed->ctrl.threshold,
|
dev->ptrfeed->ctrl.threshold,
|
||||||
(float)dev->ptrfeed->ctrl.num /
|
(float)dev->ptrfeed->ctrl.num /
|
||||||
(float)dev->ptrfeed->ctrl.den);
|
(float)dev->ptrfeed->ctrl.den);
|
||||||
|
|
||||||
if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
|
if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
|
||||||
ApplySofteningAndConstantDeceleration( velocitydata,
|
ApplySofteningAndConstantDeceleration(velocitydata,
|
||||||
dx, dy,
|
dx, dy,
|
||||||
&fdx, &fdy,
|
&fdx, &fdy,
|
||||||
(mult > 1.0f) && soften);
|
(mult > 1.0f) && soften);
|
||||||
|
|
||||||
if (dx) {
|
if (dx) {
|
||||||
tmp = mult * fdx + dev->last.remainder[0];
|
tmp = mult * fdx + dev->last.remainder[0];
|
||||||
|
@ -1097,13 +1121,15 @@ acceleratePointerPredictable(
|
||||||
* process each axis conditionally, there's no danger
|
* process each axis conditionally, there's no danger
|
||||||
* of a toggling remainder. Its lack of guarantees likely
|
* of a toggling remainder. Its lack of guarantees likely
|
||||||
* makes it faster on the average target. */
|
* makes it faster on the average target. */
|
||||||
*px = lrintf(tmp);
|
tmpi = lrintf(tmp);
|
||||||
dev->last.remainder[0] = tmp - (float)*px;
|
valuator_mask_set(val, 0, tmpi);
|
||||||
|
dev->last.remainder[0] = tmp - (float)tmpi;
|
||||||
}
|
}
|
||||||
if (dy) {
|
if (dy) {
|
||||||
tmp = mult * fdy + dev->last.remainder[1];
|
tmp = mult * fdy + dev->last.remainder[1];
|
||||||
*py = lrintf(tmp);
|
tmpi = lrintf(tmp);
|
||||||
dev->last.remainder[1] = tmp - (float)*py;
|
valuator_mask_set(val, 1, tmpi);
|
||||||
|
dev->last.remainder[1] = tmp - (float)tmpi;
|
||||||
}
|
}
|
||||||
DebugAccelF("pos (%i | %i) remainders x: %.3f y: %.3f delta x:%.3f y:%.3f\n",
|
DebugAccelF("pos (%i | %i) remainders x: %.3f y: %.3f delta x:%.3f y:%.3f\n",
|
||||||
*px, *py, dev->last.remainder[0], dev->last.remainder[1], fdx, fdy);
|
*px, *py, dev->last.remainder[0], dev->last.remainder[1], fdx, fdy);
|
||||||
|
@ -1124,25 +1150,18 @@ acceleratePointerPredictable(
|
||||||
void
|
void
|
||||||
acceleratePointerLightweight(
|
acceleratePointerLightweight(
|
||||||
DeviceIntPtr dev,
|
DeviceIntPtr dev,
|
||||||
int first_valuator,
|
ValuatorMask* val,
|
||||||
int num_valuators,
|
CARD32 ignored)
|
||||||
int *valuators,
|
|
||||||
int ignored)
|
|
||||||
{
|
{
|
||||||
float mult = 0.0;
|
float mult = 0.0, tmpf;
|
||||||
int dx = 0, dy = 0;
|
int dx = 0, dy = 0, tmpi;
|
||||||
int *px = NULL, *py = NULL;
|
|
||||||
|
|
||||||
if (!num_valuators || !valuators)
|
if (valuator_mask_isset(val, 0)) {
|
||||||
return;
|
dx = valuator_mask_get(val, 0);
|
||||||
|
|
||||||
if (first_valuator == 0) {
|
|
||||||
dx = valuators[0];
|
|
||||||
px = &valuators[0];
|
|
||||||
}
|
}
|
||||||
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
|
|
||||||
dy = valuators[1 - first_valuator];
|
if (valuator_mask_isset(val, 1)) {
|
||||||
py = &valuators[1 - first_valuator];
|
dy = valuator_mask_get(val, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dx && !dy)
|
if (!dx && !dy)
|
||||||
|
@ -1152,45 +1171,45 @@ acceleratePointerLightweight(
|
||||||
/* modeled from xf86Events.c */
|
/* modeled from xf86Events.c */
|
||||||
if (dev->ptrfeed->ctrl.threshold) {
|
if (dev->ptrfeed->ctrl.threshold) {
|
||||||
if ((abs(dx) + abs(dy)) >= dev->ptrfeed->ctrl.threshold) {
|
if ((abs(dx) + abs(dy)) >= dev->ptrfeed->ctrl.threshold) {
|
||||||
dev->last.remainder[0] = ((float)dx *
|
tmpf = ((float)dx *
|
||||||
(float)(dev->ptrfeed->ctrl.num)) /
|
(float)(dev->ptrfeed->ctrl.num)) /
|
||||||
(float)(dev->ptrfeed->ctrl.den) +
|
(float)(dev->ptrfeed->ctrl.den) +
|
||||||
dev->last.remainder[0];
|
dev->last.remainder[0];
|
||||||
if (px) {
|
if (dx) {
|
||||||
*px = (int)dev->last.remainder[0];
|
tmpi = (int) tmpf;
|
||||||
dev->last.remainder[0] = dev->last.remainder[0] -
|
valuator_mask_set(val, 0, tmpi);
|
||||||
(float)(*px);
|
dev->last.remainder[0] = tmpf - (float)tmpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->last.remainder[1] = ((float)dy *
|
tmpf = ((float)dy *
|
||||||
(float)(dev->ptrfeed->ctrl.num)) /
|
(float)(dev->ptrfeed->ctrl.num)) /
|
||||||
(float)(dev->ptrfeed->ctrl.den) +
|
(float)(dev->ptrfeed->ctrl.den) +
|
||||||
dev->last.remainder[1];
|
dev->last.remainder[1];
|
||||||
if (py) {
|
if (dy) {
|
||||||
*py = (int)dev->last.remainder[1];
|
tmpi = (int) tmpf;
|
||||||
dev->last.remainder[1] = dev->last.remainder[1] -
|
valuator_mask_set(val, 1, tmpi);
|
||||||
(float)(*py);
|
dev->last.remainder[1] = tmpf - (float)tmpi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
|
mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
|
||||||
((float)(dev->ptrfeed->ctrl.num) /
|
((float)(dev->ptrfeed->ctrl.num) /
|
||||||
(float)(dev->ptrfeed->ctrl.den) - 1.0) /
|
(float)(dev->ptrfeed->ctrl.den) - 1.0) /
|
||||||
2.0) / 2.0;
|
2.0) / 2.0;
|
||||||
if (dx) {
|
if (dx) {
|
||||||
dev->last.remainder[0] = mult * (float)dx +
|
tmpf = mult * (float)dx +
|
||||||
dev->last.remainder[0];
|
dev->last.remainder[0];
|
||||||
*px = (int)dev->last.remainder[0];
|
tmpi = (int) tmpf;
|
||||||
dev->last.remainder[0] = dev->last.remainder[0] -
|
valuator_mask_set(val, 0, tmpi);
|
||||||
(float)(*px);
|
dev->last.remainder[0] = tmpf - (float)tmpi;
|
||||||
}
|
}
|
||||||
if (dy) {
|
if (dy) {
|
||||||
dev->last.remainder[1] = mult * (float)dy +
|
tmpf = mult * (float)dy +
|
||||||
dev->last.remainder[1];
|
dev->last.remainder[1];
|
||||||
*py = (int)dev->last.remainder[1];
|
tmpi = (int)tmpf;
|
||||||
dev->last.remainder[1] = dev->last.remainder[1] -
|
valuator_mask_set(val, 1, tmpi);
|
||||||
(float)(*py);
|
dev->last.remainder[1] = tmpf - (float)tmpi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,15 +817,18 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
|
||||||
/* Enable it if it's properly initialised and we're currently in the VT */
|
/* Enable it if it's properly initialised and we're currently in the VT */
|
||||||
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
|
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
|
||||||
{
|
{
|
||||||
|
OsBlockSignals();
|
||||||
EnableDevice(dev, TRUE);
|
EnableDevice(dev, TRUE);
|
||||||
if (!dev->enabled)
|
if (!dev->enabled)
|
||||||
{
|
{
|
||||||
|
OsReleaseSignals();
|
||||||
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
|
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
|
||||||
rval = BadMatch;
|
rval = BadMatch;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
/* send enter/leave event, update sprite window */
|
/* send enter/leave event, update sprite window */
|
||||||
CheckMotion(NULL, dev);
|
CheckMotion(NULL, dev);
|
||||||
|
OsReleaseSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
*pdev = dev;
|
*pdev = dev;
|
||||||
|
|
|
@ -106,6 +106,8 @@ typedef struct _ClassesRec *ClassesPtr;
|
||||||
typedef struct _SpriteRec *SpritePtr;
|
typedef struct _SpriteRec *SpritePtr;
|
||||||
typedef union _GrabMask GrabMask;
|
typedef union _GrabMask GrabMask;
|
||||||
|
|
||||||
|
typedef struct _ValuatorMask ValuatorMask;
|
||||||
|
|
||||||
typedef struct _EventList {
|
typedef struct _EventList {
|
||||||
xEvent* event;
|
xEvent* event;
|
||||||
int evlen; /* length of allocated memory for event in bytes. This is not
|
int evlen; /* length of allocated memory for event in bytes. This is not
|
||||||
|
@ -141,11 +143,9 @@ typedef void (*DeviceUnwrapProc)(
|
||||||
|
|
||||||
/* pointer acceleration handling */
|
/* pointer acceleration handling */
|
||||||
typedef void (*PointerAccelSchemeProc)(
|
typedef void (*PointerAccelSchemeProc)(
|
||||||
DeviceIntPtr /*pDev*/,
|
DeviceIntPtr /*device*/,
|
||||||
int /*first_valuator*/,
|
ValuatorMask* /*valuators*/,
|
||||||
int /*num_valuators*/,
|
CARD32 /*evtime*/);
|
||||||
int* /*valuators*/,
|
|
||||||
int /*evtime*/);
|
|
||||||
|
|
||||||
typedef void (*DeviceCallbackProc)(
|
typedef void (*DeviceCallbackProc)(
|
||||||
DeviceIntPtr /*pDev*/);
|
DeviceIntPtr /*pDev*/);
|
||||||
|
@ -163,8 +163,6 @@ typedef struct _DeviceRec {
|
||||||
Bool on; /* used by DDX to keep state */
|
Bool on; /* used by DDX to keep state */
|
||||||
} DeviceRec, *DevicePtr;
|
} DeviceRec, *DevicePtr;
|
||||||
|
|
||||||
typedef struct _ValuatorMask ValuatorMask;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int click, bell, bell_pitch, bell_duration;
|
int click, bell, bell_pitch, bell_duration;
|
||||||
Bool autoRepeat;
|
Bool autoRepeat;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright © 2006-2009 Simon Thum simon dot thum at gmx dot de
|
* Copyright © 2006-2011 Simon Thum simon dot thum at gmx dot de
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
#ifndef POINTERVELOCITY_H
|
#ifndef POINTERVELOCITY_H
|
||||||
#define POINTERVELOCITY_H
|
#define POINTERVELOCITY_H
|
||||||
|
|
||||||
#include <input.h> /* DeviceIntPtr */
|
#include <input.h>
|
||||||
|
|
||||||
/* constants for acceleration profiles */
|
/* constants for acceleration profiles */
|
||||||
|
|
||||||
|
@ -62,9 +62,6 @@ typedef struct _MotionTracker {
|
||||||
int dir; /* initial direction bitfield */
|
int dir; /* initial direction bitfield */
|
||||||
} MotionTracker, *MotionTrackerPtr;
|
} MotionTracker, *MotionTrackerPtr;
|
||||||
|
|
||||||
/* number of properties for predictable acceleration */
|
|
||||||
#define NPROPS_PREDICTABLE_ACCEL 4
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all data needed to implement mouse ballistics
|
* Contains all data needed to implement mouse ballistics
|
||||||
*/
|
*/
|
||||||
|
@ -91,9 +88,18 @@ typedef struct _DeviceVelocityRec {
|
||||||
struct { /* to be able to query this information */
|
struct { /* to be able to query this information */
|
||||||
int profile_number;
|
int profile_number;
|
||||||
} statistics;
|
} statistics;
|
||||||
long prop_handlers[NPROPS_PREDICTABLE_ACCEL];
|
|
||||||
} DeviceVelocityRec, *DeviceVelocityPtr;
|
} DeviceVelocityRec, *DeviceVelocityPtr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* contains the run-time data for the predictable scheme, that is, a
|
||||||
|
* DeviceVelocityPtr and the property handlers.
|
||||||
|
*/
|
||||||
|
typedef struct _PredictableAccelSchemeRec {
|
||||||
|
DeviceVelocityPtr vel;
|
||||||
|
long* prop_handlers;
|
||||||
|
int num_prop_handlers;
|
||||||
|
} PredictableAccelSchemeRec, *PredictableAccelSchemePtr;
|
||||||
|
|
||||||
extern _X_EXPORT void
|
extern _X_EXPORT void
|
||||||
InitVelocityData(DeviceVelocityPtr vel);
|
InitVelocityData(DeviceVelocityPtr vel);
|
||||||
|
|
||||||
|
@ -128,11 +134,11 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
|
||||||
struct _ValuatorAccelerationRec* protoScheme);
|
struct _ValuatorAccelerationRec* protoScheme);
|
||||||
|
|
||||||
extern _X_INTERNAL void
|
extern _X_INTERNAL void
|
||||||
acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
|
acceleratePointerPredictable(DeviceIntPtr dev, ValuatorMask* val,
|
||||||
int num_valuators, int *valuators, int evtime);
|
CARD32 evtime);
|
||||||
|
|
||||||
extern _X_INTERNAL void
|
extern _X_INTERNAL void
|
||||||
acceleratePointerLightweight(DeviceIntPtr dev, int first_valuator,
|
acceleratePointerLightweight(DeviceIntPtr dev, ValuatorMask* val,
|
||||||
int num_valuators, int *valuators, int ignored);
|
CARD32 evtime);
|
||||||
|
|
||||||
#endif /* POINTERVELOCITY_H */
|
#endif /* POINTERVELOCITY_H */
|
||||||
|
|
|
@ -807,7 +807,6 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
|
||||||
RecordContextPtr pContext;
|
RecordContextPtr pContext;
|
||||||
RecordClientsAndProtocolPtr pRCAP;
|
RecordClientsAndProtocolPtr pRCAP;
|
||||||
int eci; /* enabled context index */
|
int eci; /* enabled context index */
|
||||||
int count;
|
|
||||||
|
|
||||||
for (eci = 0; eci < numEnabledContexts; eci++)
|
for (eci = 0; eci < numEnabledContexts; eci++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,20 +68,13 @@ xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
|
||||||
Bool
|
Bool
|
||||||
XkbInitPrivates(void)
|
XkbInitPrivates(void)
|
||||||
{
|
{
|
||||||
return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, 0);
|
return dixRegisterPrivateKey(&xkbDevicePrivateKeyRec, PRIVATE_DEVICE, sizeof(xkbDeviceInfoRec));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
|
XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
|
||||||
{
|
{
|
||||||
xkbDeviceInfoPtr xkbPrivPtr;
|
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(device);
|
||||||
|
|
||||||
xkbPrivPtr = (xkbDeviceInfoPtr) calloc(1, sizeof(xkbDeviceInfoRec));
|
|
||||||
if (!xkbPrivPtr)
|
|
||||||
return;
|
|
||||||
xkbPrivPtr->unwrapProc = NULL;
|
|
||||||
|
|
||||||
dixSetPrivate(&device->devPrivates, xkbDevicePrivateKey, xkbPrivPtr);
|
|
||||||
WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc);
|
WRAP_PROCESS_INPUT_PROC(device, xkbPrivPtr, proc, xkbUnwrapProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue