From owner-p4-projects@FreeBSD.ORG Thu Jul 19 18:03:01 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7D4141065672; Thu, 19 Jul 2012 18:03:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 356E31065670 for ; Thu, 19 Jul 2012 18:03:00 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 05B5A8FC15 for ; Thu, 19 Jul 2012 18:03:00 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JI2x2H086865 for ; Thu, 19 Jul 2012 18:02:59 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6JI2xx9086862 for perforce@freebsd.org; Thu, 19 Jul 2012 18:02:59 GMT (envelope-from brooks@freebsd.org) Date: Thu, 19 Jul 2012 18:02:59 GMT Message-Id: <201207191802.q6JI2xx9086862@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214614 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 18:03:01 -0000 http://p4web.freebsd.org/@@214614?ac=10 Change 214614 by brooks@brooks_ecr_current on 2012/07/19 18:02:40 Improve the quality of touch screen events by ignoring release events which are not followed by invalid (no-contact) readings on the next cycle. Also manufacture release events in the event that we start a ts_poll, get a no-contact reading the first time, and the previous event returned was a contact event. Convert pictview_pan() to use ts_poll.. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#11 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#11 (text+ko) ==== @@ -153,9 +153,10 @@ ts_poll(void) { struct timespec stime = {0, 1000000}; - static struct tsstate *sp; - int init = 0; - struct tsstate tmp_s; + static struct tsstate *sp = NULL; + int init = 0, first_pass = 1; + int check_release = 0; + struct tsstate tmp_s, rel_s; if (sp == NULL) { sp = malloc(sizeof(struct tsstate)); @@ -171,6 +172,22 @@ tmp_s.ts_y2 = le32toh(mtlctrl[6]); tmp_s.ts_gesture = le32toh(mtlctrl[7]); if (tmp_s.ts_gesture < 0) { + if (check_release) { + check_release = 0; + *sp = rel_s; + return (sp); + } + if (first_pass && !init && sp->ts_count > 0) { + /* + * If we returned a touch last time around + * then fake up a release now. + * XXX: we should probably have a timelimit + */ + sp->ts_count = 0; + sp->ts_gesture = 0; + return(sp); + } + first_pass = 0; nanosleep(&stime, NULL); continue; } @@ -182,9 +199,19 @@ tmp_s.ts_x2 != sp->ts_x2 || tmp_s.ts_y2 != sp->ts_y2 || tmp_s.ts_count != sp->ts_count || tmp_s.ts_gesture != sp->ts_gesture) { - *sp = tmp_s; - return (sp); + /* + * If we get an release event, differ returning + * it until we sleep and get a non-event. + */ + if (tmp_s.ts_count == 0) { + check_release = 1; + rel_s = tmp_s; + } else { + *sp = tmp_s; + return (sp); + } } + first_pass = 0; nanosleep(&stime, NULL); } }