On Wed, Mar 3, 2010 at 1:59 PM, Ping Cheng <pingli...@gmail.com> wrote: > On Wed, Mar 3, 2010 at 11:29 AM, Chris Bagwell <ch...@cnpbagwell.com> wrote: >> >> On Wed, Mar 3, 2010 at 1:03 PM, Ping Cheng <pingli...@gmail.com> wrote: >> >> 7) On touchpads, should tap gestures be supported to cause left button >> >> press? >> >> >> >> My preference: Yes. >> > >> > We don't have this feature in the driver right now. But I don't see a >> > reason >> > that we should not support it. If you have time, you can make a patch >> > for >> > this feature. >> 1 finger tap is in the bamboo branch of xf86-input-wacom already (my >> patch). We kinda get it for free if we unify one finger and two >> finger gesture logic. > > Yes, please send the patch to me (also, for the patch I mentioned yesterday, > I was talking about your xf86-input-wacom patch on reducing jump issues, not > the kernel one you sent me. I have your kernel one in my email history. > It's the xf86-input-wacom one that I didn't want to go through the repo > for). Please send both to myself.
Oh, I see now. I mis-understood. There really isn't a patch I can send you. What I did is simplify my wcmEvent() gesture logic to be only this: if (ds.device_type == TOUCH_ID && common->wcmTouch && common->wcmGesture) /* Consume data if requested */ if (wcmTouchFilter(common, priv, channel)) goto ret; /* everything else falls here */ commonDispatchDevice(common,channel,pChannel,suppress); ret: resetSampleCounter(pChannel); Next, the function wcmTouchFilter() is a rewrite which had a side affect of removing all the buggy paths that would allow commonDispatchDevice() to be called for channel 1. You've got a solution that puts an if() around commonDispatchDevice() that stops any slips threw. > If you plan to port xdrv to xf86-input-wacom, please wait until next week. > I am working on -11 and I plan (wish me luck :) to post it before this > weekend. There are new changes I need you and the list to test before you > port them to xf86-input-wacom. I appreciate the heads up. Good luck! >> Do you have an opinion on unifying 1 and 2 finger gesture logic? You >> did quite a bit of cleanup but didn't go as far as the unify step. Is >> that because you prefer them separate or is it because it was easier >> to stick with current framework? > > > The rational behind my decision in keeping 1 and 2 finger code separate is > to make the relative vs. absolute, hence touchpad vs. touchscreen, support > relatively independent. There is no single finger gesture for > touchscreen, first finger data fall into the same path as we did for the > single finger touchscreen devices. However, relative devices, only Bamboo > touch for now, don't have single finger models. Does that make sense to you? OK, that makes sense. The case of single touch devices I need to reconsider in my patches but I think it will "just work" because of initializing ds[1] to zeros. On the flip side (combining gesture logic that is), we don't need gesture state data for each finger and don't have to have as much clean up logic when your transitioning between one and two finger gesture modes. There is also alot of redundant logic you can take advantage of. Hopefully all don't mind but I'll copy my version of combined gesture logic into this email. I find it easier to follow this then the separate gesture logic but perhaps others do not. Although it works bug free for me, I consider this a draft still (I think I see a couple bugs browsing over it just now). I stopped working on it when linuxwacom-0.8.5-10 came out and I saw how incompatible they were. Chris /* Filters out events related to following gestures and replaces with * specified action: * * Single and Double Finger Taps - Left and Right button click * Double Finger Scroll - Scroll Button Events * Double Finger Pinch Zoom - Zoom Finger Events * Single and Double Finger Touches - Left and Right Button Clicks * * In addition, Touch gestures let standard X/Y data to be processed * as normal. */ int wcmTouchFilter(WacomCommonPtr common, WacomDevicePtr priv, unsigned int channel) { WacomChannelPtr firstChannel = common->wcmChannel; WacomChannelPtr secondChannel = common->wcmChannel + 1; WacomDeviceState ds[2] = { firstChannel->valid.state, secondChannel->valid.state }; WacomDeviceState dsLast[2] = { firstChannel->valid.states[1], secondChannel->valid.states[1] }; if (!IsTouch(priv)) { /* this should never happen */ xf86Msg(X_ERROR, "WACOM: No touch device found for %s \n", common->wcmDevice); return TRUE; } DBG(10, priv, "channel = %d, mode = %d, " "ds[0].x = %d, ds[0].y = %d, ds[1].x = %d, ds[1].y = %d, " "ds[0].sample = %d, ds[1].sample = %d, " "wcmGestureState[0].sample = %d, wcmGestureState[1].sample = %d, " "wcmGestureFingers = %d ds[0].proximity = %s, ds[1].proximity = %s\n", channel, common->wcmGestureMode, ds[0].x, ds[0].y, ds[1].x, ds[1].y, ds[0].sample, ds[1].sample, common->wcmGestureState[0].sample, common->wcmGestureState[1].sample, common->wcmGestureFingers, ds[0].proximity ? "true" : "false", ds[1].proximity ? "true" : "false"); /* Detect when both fingers are removed */ if (!ds[0].proximity && !ds[1].proximity) { if (common->wcmGestureMode == GESTURE_DETECT_MODE) { /* In relative mode, we met condition * to send button down. */ if (!(priv->flags & ABSOLUTE_FLAG)) { /* left for single finger * right for double finger */ if (common->wcmGestureFingers == 1) common->wcmGestureButtonDown = 1; else common->wcmGestureButtonDown = 3; xf86PostButtonEvent(priv->local->dev, priv->flags&ABSOLUTE_FLAG, common->wcmGestureButtonDown, 1,0,0); xf86PostButtonEvent(priv->local->dev, priv->flags&ABSOLUTE_FLAG, common->wcmGestureButtonDown, 0,0,0); common->wcmGestureButtonDown = 0; } common->wcmGestureMode = 0; } else if (common->wcmGestureMode == GESTURE_PASSTHRU_MODE) { if (common->wcmGestureButtonDown) { xf86PostButtonEvent(priv->local->dev, priv->flags&ABSOLUTE_FLAG, common->wcmGestureButtonDown, 0,0,0); common->wcmGestureButtonDown = 0; } common->wcmGestureMode = 0; return channel; } else common->wcmGestureMode = 0; return TRUE; } /* Process one and two finger gestures at same time. * Commit to gesture at wcmGestureTapTime time. */ switch (common->wcmGestureMode) { case GESTURE_NO_MODE: /* Transition into single finger gesture * mode and store its related state. */ common->wcmGestureMode = GESTURE_DETECT_MODE; common->wcmGestureState[0] = ds[0]; /* Consume and return because we always need * at least two samples to do next step. */ case GESTURE_DETECT_MODE: { int dist = touchDistance(ds[0], common->wcmGestureState[0]); if (ds[1].proximity) common->wcmGestureFingers = 2; else common->wcmGestureFingers = 1; /* Store initial second finger state */ if (ds[1].proximity && !dsLast[1].proximity) common->wcmGestureState[1] = ds[1]; /* As long as less then 200ms and didn't * move to much, then consume event * until we know enough to determine tap * vs. touch. */ if ((GetTimeInMillis() - common->wcmGestureState[0].sample) <= common->wcmGestureTapTime && (dist <= common->wcmGestureTapDistance)) return TRUE; /* Process no movement case first. */ if (dist <= common->wcmGestureTapDistance) { common->wcmGestureMode = GESTURE_PASSTHRU_MODE; /* For touchscreens, perform a left * button press. */ /* FIXME: If we are going to * support Touchscreen button * presses right here then it * looks like duplicate of * (CapacityDefault >= 0) * logic in commonDispatchDevice. * I do not know that code * good enough yet to know were * logic needs to live. */ if (priv->flags & ABSOLUTE_FLAG) { if (common->wcmGestureFingers == 1) common->wcmGestureButtonDown = 1; else common->wcmGestureButtonDown = 3; /* left button down */ xf86PostButtonEvent(priv->local->dev, priv->flags&ABSOLUTE_FLAG, common->wcmGestureButtonDown, 1,0,0); } } else if (common->wcmGestureFingers == 2) { int direction = 0; /* Detect if first finger is moving * in a line and then verify * finger two is following the same * line. */ if (pointsInLine(common, ds[0], common->wcmGestureState[0], &direction) && pointsInLine(common, ds[1], common->wcmGestureState[1], &direction)) { if (direction == WACOM_HORIZ_POS || direction == WACOM_HORIZ_NEG) common->wcmGestureMode = GESTURE_SCROLL_HORZ_MODE; else common->wcmGestureMode = GESTURE_SCROLL_VERT_MODE; wcmFingerScroll(priv); } else if (abs(touchDistance(common->wcmGestureState[0], common->wcmGestureState[1]) - touchDistance(ds[0], ds[1])) > common->wcmGestureZoomDelta) { common->wcmGestureMode = GESTURE_ZOOM_MODE; wcmFingerZoom(priv); } else common->wcmGestureMode = GESTURE_PASSTHRU_MODE; } else common->wcmGestureMode = GESTURE_PASSTHRU_MODE; } break; case GESTURE_PASSTHRU_MODE: /* Only let channel 0 events processed normally. */ return channel; case GESTURE_SCROLL_HORZ_MODE: case GESTURE_SCROLL_VERT_MODE: { int direction = 0; /* Since both fingers will be moving with * this gesture, only process first finger * data to prevent double-sends of * scroll events. * Go ahead and look for invalid range * and abort gesture in that case. */ if (channel) { if (!(pointsInLine(common, ds[1], common->wcmGestureState[1], &direction))) /* Come out of scroll mode */ common->wcmGestureMode = GESTURE_PASSTHRU_MODE; return TRUE; } /* Since second figure was validated in * its own context, just check validity * first figure now. */ if (pointsInLine(common, ds[0], common->wcmGestureState[0], &direction)) wcmFingerScroll(priv); else /* Come out of scroll mode */ common->wcmGestureMode = GESTURE_PASSTHRU_MODE; } break; case GESTURE_ZOOM_MODE: wcmFingerZoom(priv); break; default: /* Should not happen */ common->wcmGestureMode = GESTURE_NO_MODE; break; } return TRUE; } ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel