diff options
-rwxr-xr-x | src/xdrv/wcmCommon.c | 45 | ||||
-rwxr-xr-x | src/xdrv/wcmConfig.c | 13 | ||||
-rwxr-xr-x | src/xdrv/wcmFilter.c | 5 |
3 files changed, 34 insertions, 29 deletions
diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c index 178f7a9..3c951c6 100755 --- a/src/xdrv/wcmCommon.c +++ b/src/xdrv/wcmCommon.c @@ -692,6 +692,9 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds, unsigne int i; for (i=0; i<abs(ds->relwheel); i++) { + /* Dynamically modify the button map + */ + local->dev->button->map [fakeButton] = fakeButton; xf86PostButtonEvent(local->dev, is_absolute, fakeButton, 1, 0, naxes, rx, ry, rz, v3, v4, v5); @@ -777,6 +780,8 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds, unsigne static int xf86WcmSuppress(int suppress, const WacomDeviceState* dsOrig, const WacomDeviceState* dsNew) { + int drot; + /* NOTE: Suppression value of zero disables suppression. */ DBG(11, ErrorF("xf86WcmSuppress checking data (suppress=%d)\n", suppress)); @@ -790,10 +795,10 @@ static int xf86WcmSuppress(int suppress, const WacomDeviceState* dsOrig, if (ABS(dsOrig->stripy - dsNew->stripy) > suppress) return 0; if (ABS(dsOrig->pressure - dsNew->pressure) > suppress) return 0; if (ABS(dsOrig->throttle - dsNew->throttle) > suppress) return 0; - - if (ABS(dsOrig->rotation - dsNew->rotation) > suppress || - (1800 - ABS(dsNew->rotation - dsOrig->rotation)) > suppress) - return 0; + drot = ABS(dsOrig->rotation - dsNew->rotation)-900 ? + 1800 - ABS(dsOrig->rotation - dsNew->rotation) : + ABS(dsNew->rotation - dsOrig->rotation); + if (drot > suppress) return 0; /* look for change in absolute wheel * position or any relative wheel movement */ @@ -862,7 +867,7 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, WacomDeviceState* pLast; WacomDeviceState ds; WacomChannelPtr pChannel; - WacomFilterState fs; + WacomFilterState* fs; int i; /* tool on the tablet when driver starts */ @@ -907,37 +912,37 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, return; /* discard */ } #endif - fs = pChannel->rawFilter; - if (!fs.npoints && ds.proximity) + fs = &pChannel->rawFilter; + if (!fs->npoints && ds.proximity) { DBG(11, ErrorF("initialize Channel data.\n")); /* store channel device state for later use */ for (i=MAX_SAMPLES - 1; i>=0; i--) { - fs.x[i]= ds.x; - fs.y[i]= ds.y; - fs.tiltx[i] = ds.tiltx; - fs.tilty[i] = ds.tilty; + fs->x[i]= ds.x; + fs->y[i]= ds.y; + fs->tiltx[i] = ds.tiltx; + fs->tilty[i] = ds.tilty; } - ++fs.npoints; + ++fs->npoints; } else { /* Filter raw data, fix hardware defects, perform error correction */ for (i=MAX_SAMPLES - 1; i>0; i--) { - fs.x[i]= fs.x[i-1]; - fs.y[i]= fs.y[i-1]; + fs->x[i]= fs->x[i-1]; + fs->y[i]= fs->y[i-1]; } - fs.x[0] = ds.x; - fs.y[0] = ds.y; + fs->x[0] = ds.x; + fs->y[0] = ds.y; if (HANDLE_TILT(common) && (ds.device_type == STYLUS_ID || ds.device_type == ERASER_ID)) { for (i=MAX_SAMPLES - 1; i>0; i--) { - fs.tiltx[i]= fs.tiltx[i-1]; - fs.tilty[i]= fs.tilty[i-1]; + fs->tiltx[i]= fs->tiltx[i-1]; + fs->tilty[i]= fs->tilty[i-1]; } - fs.tiltx[0] = ds.tiltx; - fs.tilty[0] = ds.tilty; + fs->tiltx[0] = ds.tiltx; + fs->tilty[0] = ds.tilty; } if (RAW_FILTERING(common) && common->wcmModel->FilterRaw) { diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c index ce175ba..f4a1ecb 100755 --- a/src/xdrv/wcmConfig.c +++ b/src/xdrv/wcmConfig.c @@ -436,17 +436,18 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) common->wcmRotate=ROTATE_CW; else if (xf86NameCmp(s, "CCW") ==0) common->wcmRotate=ROTATE_CCW; + else if (xf86NameCmp(s, "HALF") ==0) + common->wcmRotate=ROTATE_HALF; xf86Msg(X_CONFIG, "WACOM: Rotation is set to %s\n", s); } common->wcmSuppress = xf86SetIntOption(local->options, "Suppress", common->wcmSuppress); - if ((common->wcmSuppress != 0) && /* 0 disables suppression */ - (common->wcmSuppress > MAX_SUPPRESS || - common->wcmSuppress < DEFAULT_SUPPRESS)) - { - common->wcmSuppress = DEFAULT_SUPPRESS; - } + if (common->wcmSuppress != 0) /* 0 disables suppression */ + if (common->wcmSuppress > MAX_SUPPRESS) + common->wcmSuppress = MAX_SUPPRESS; + if (common->wcmSuppress < DEFAULT_SUPPRESS) + common->wcmSuppress = DEFAULT_SUPPRESS; xf86Msg(X_CONFIG, "WACOM: suppress value is %d\n", common->wcmSuppress); if (xf86SetBoolOption(local->options, "Tilt", diff --git a/src/xdrv/wcmFilter.c b/src/xdrv/wcmFilter.c index 189fa79..13122c0 100755 --- a/src/xdrv/wcmFilter.c +++ b/src/xdrv/wcmFilter.c @@ -229,7 +229,6 @@ static void filterIntuosCoord(int* state, int* current) { int x=0, i; - x = *current; for ( i=0; i<MAX_SAMPLES; i++ ) x += state[i]; @@ -247,7 +246,7 @@ static void filterIntuosTilt(int* state, int* tilt) int i; *tilt = 0; - for ( i=MAX_SAMPLES-1; i>=0; i-- ) + for ( i=0; i<MAX_SAMPLES; i++ ) { *tilt += state[i]; } @@ -280,7 +279,7 @@ int xf86WcmFilterCoord(WacomCommonPtr common, WacomChannelPtr pChannel, filter_x = 0; filter_y = 0; - for ( i=MAX_SAMPLES-1; i>=0; i-- ) + for ( i=0; i<MAX_SAMPLES; i++ ) { filter_x += x[i]; filter_y += y[i]; |