--- wsp.c.orig 2014-01-30 08:14:26.000000000 +0800 +++ wsp.c 2014-01-30 13:49:59.000000000 +0800 @@ -957,8 +957,8 @@ if (h->q2 == 4) sc->intr_count++; - if (sc->ntaps < n) { - switch (n) { + if (sc->ntaps < ntouch) { + switch (ntouch) { case 1: if (f[0].touch_major > tun.pressure_tap_threshold) sc->ntaps = 1; @@ -978,7 +978,7 @@ break; } } - if (n == 2) { + if (ntouch == 2) { sc->distance = max(sc->distance, max( abs(sc->pos_x[0] - sc->pos_x[1]), abs(sc->pos_y[0] - sc->pos_y[1]))); @@ -1050,12 +1050,20 @@ if (sc->sc_touch == WSP_SECOND_TOUCH) sc->sc_touch = WSP_TOUCHING; - if (n != 0 && + if (ntouch != 0 && h->q2 == 4 && f[0].touch_major >= tun.pressure_touch_threshold) { dx = sc->pos_x[0] - sc->pre_pos_x; dy = sc->pos_y[0] - sc->pre_pos_y; - if (n == 2 && sc->sc_status.button != 0) { + + /* Ignore movement from ibt=1 to ibt=0 */ + if (sc->sc_status.obutton != 0 && + sc->sc_status.button == 0) { + dx = 0; + dy = 0; + } + + if (ntouch == 2 && sc->sc_status.button != 0) { dx = sc->pos_x[sc->finger] - sc->pre_pos_x; dy = sc->pos_y[sc->finger] - sc->pre_pos_y; if (f[0].origin == 0 || f[1].origin == 0) { @@ -1092,7 +1100,7 @@ sc->dx_sum += dx; sc->dy_sum += dy; - if (n == 2 && sc->sc_status.button == 0) { + if (ntouch == 2 && sc->sc_status.button == 0) { if (sc->scr_mode == WSP_SCR_NONE && abs(sc->dx_sum) + abs(sc->dy_sum) > 50) sc->scr_mode = abs(sc->dx_sum) > @@ -1134,7 +1142,7 @@ sc->pre_pos_x = sc->pos_x[0]; sc->pre_pos_y = sc->pos_y[0]; - if (n == 2 && sc->sc_status.button != 0) { + if (ntouch == 2 && sc->sc_status.button != 0) { sc->pre_pos_x = sc->pos_x[sc->finger]; sc->pre_pos_y = sc->pos_y[sc->finger]; }