9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.robot.com.sun.glass.ui.monocle.input.devices;
27
28 import test.robot.com.sun.glass.ui.monocle.TestApplication;
29 import com.sun.glass.ui.monocle.TestLog;
30 import test.robot.com.sun.glass.ui.monocle.UInput;
31 import org.junit.Assume;
32
33 import java.util.HashSet;
34 import java.util.Set;
35
36 /** The touch screen used in the Freescale i.MX6Q Sabre Device Platform,
37 * extrapolated to five touch points. There is some guesswork here as to
38 * whether the screen always resends stationary points and what happens when
39 * all fingers are removed from the screen. Also, on some devices on release
40 * of the last point no tracking ID is sent. Instead we get the following event
41 * sequence:
42 *
43 * EV_ABS ABS_MT_TOUCH_MAJOR 0
44 * EV_KEY BTN_TOUCH 0
45 * EV_SYN SYN_MT_REPORT 0
46 *
47 * On other devices a touch ID of -1 is sent on release of the last point
48 * instead of the touch ID that has been used until then.
49 *
177 public void sync() {
178 if (resendStationaryPoints) {
179 for (int p = 0; p < points.length; p++) {
180 if (points[p] && !modifiedPoints.contains(p)) {
181 ui.processLine("EV_ABS ABS_MT_TRACKING_ID " + p);
182 if (sendTouchMajor) {
183 ui.processLine("EV_ABS ABS_MT_TOUCH_MAJOR 1");
184 }
185 ui.processLine("EV_ABS ABS_MT_POSITION_X " + transformedXs[p]);
186 ui.processLine("EV_ABS ABS_MT_POSITION_Y " + transformedYs[p]);
187 ui.processLine("EV_SYN SYN_MT_REPORT 0");
188 }
189 }
190 }
191 modifiedPoints.clear();
192 super.sync();
193 }
194
195 @Override
196 public void resendStateAndSync() {
197 TestLog.log("TestTouchDevice: sync");
198 for (int p = 0; p < points.length; p++) {
199 if (points[p]) {
200 ui.processLine("EV_ABS ABS_MT_TRACKING_ID " + p);
201 ui.processLine("EV_ABS ABS_MT_TOUCH_MAJOR 1");
202 ui.processLine("EV_ABS ABS_MT_POSITION_X " + transformedXs[p]);
203 ui.processLine("EV_ABS ABS_MT_POSITION_Y " + transformedYs[p]);
204 ui.processLine("EV_SYN SYN_MT_REPORT 0");
205 }
206 }
207 modifiedPoints.clear();
208 sync();
209 }
210
211 }
|
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.robot.com.sun.glass.ui.monocle.input.devices;
27
28 import test.robot.com.sun.glass.ui.monocle.TestApplication;
29 import com.sun.glass.ui.monocle.TestLogShim;
30 import test.robot.com.sun.glass.ui.monocle.UInput;
31 import org.junit.Assume;
32
33 import java.util.HashSet;
34 import java.util.Set;
35
36 /** The touch screen used in the Freescale i.MX6Q Sabre Device Platform,
37 * extrapolated to five touch points. There is some guesswork here as to
38 * whether the screen always resends stationary points and what happens when
39 * all fingers are removed from the screen. Also, on some devices on release
40 * of the last point no tracking ID is sent. Instead we get the following event
41 * sequence:
42 *
43 * EV_ABS ABS_MT_TOUCH_MAJOR 0
44 * EV_KEY BTN_TOUCH 0
45 * EV_SYN SYN_MT_REPORT 0
46 *
47 * On other devices a touch ID of -1 is sent on release of the last point
48 * instead of the touch ID that has been used until then.
49 *
177 public void sync() {
178 if (resendStationaryPoints) {
179 for (int p = 0; p < points.length; p++) {
180 if (points[p] && !modifiedPoints.contains(p)) {
181 ui.processLine("EV_ABS ABS_MT_TRACKING_ID " + p);
182 if (sendTouchMajor) {
183 ui.processLine("EV_ABS ABS_MT_TOUCH_MAJOR 1");
184 }
185 ui.processLine("EV_ABS ABS_MT_POSITION_X " + transformedXs[p]);
186 ui.processLine("EV_ABS ABS_MT_POSITION_Y " + transformedYs[p]);
187 ui.processLine("EV_SYN SYN_MT_REPORT 0");
188 }
189 }
190 }
191 modifiedPoints.clear();
192 super.sync();
193 }
194
195 @Override
196 public void resendStateAndSync() {
197 TestLogShim.log("TestTouchDevice: sync");
198 for (int p = 0; p < points.length; p++) {
199 if (points[p]) {
200 ui.processLine("EV_ABS ABS_MT_TRACKING_ID " + p);
201 ui.processLine("EV_ABS ABS_MT_TOUCH_MAJOR 1");
202 ui.processLine("EV_ABS ABS_MT_POSITION_X " + transformedXs[p]);
203 ui.processLine("EV_ABS ABS_MT_POSITION_Y " + transformedYs[p]);
204 ui.processLine("EV_SYN SYN_MT_REPORT 0");
205 }
206 }
207 modifiedPoints.clear();
208 sync();
209 }
210
211 }
|