Merge lp:~ilidrissi.amine/gesturetest/621600-no-args into lp:gesturetest

Proposed by Mohamed Amine Ilidrissi
Status: Rejected
Rejected by: Chase Douglas
Proposed branch: lp:~ilidrissi.amine/gesturetest/621600-no-args
Merge into: lp:gesturetest
Diff against target: 94 lines (+48/-36)
1 file modified
src/main.c (+48/-36)
To merge this branch: bzr merge lp:~ilidrissi.amine/gesturetest/621600-no-args
Reviewer Review Type Date Requested Status
Chase Douglas (community) Approve
Henrik Rydberg (community) Approve
Review via email: mp+36641@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Henrik Rydberg (rydberg) wrote :

Looks ok to me.

review: Approve
Revision history for this message
Chase Douglas (chasedouglas) wrote :

I'm sorry I haven't gotten back to this sooner, but I'm against this change. gesturetest is not a demo program that you run to see things fly across your screen when you perform gestures :). It's a test tool that must be used in specific ways to get the results you want to see.

For example, if you are interested in testing rotation gestures, you should subscribe only to them and not to other gestures. As soon as you start to listen for other gestures things get very confusing. It can be hard to understand why you might be receiving drag gestures when you perform a pivot rotation, and subscribing to all gestures by default only exacerbates the issue. Essentially, I don't want people to run gesturetest and make decisions based on poor testing scenarios.

review: Disapprove
Revision history for this message
Mohamed Amine Ilidrissi (ilidrissi.amine) wrote :

So, for example, if a program listens to 2 different gestures at the same time (if it's waiting for the user to do something for example), those 2 gestures can collide, confusing the user? If so, shouldn't that be fixed?
(Just asking ; I don't know anything about gestures :p)

Revision history for this message
Chase Douglas (chasedouglas) wrote :

I'll give an example that caused us issues. If you want to perform a rotation where one finger pivots around another, you will receive both rotation and drag events. The reason is that gestures are performed about a point in space. Our gesture system uses the center (average) of all the touch points as this "focus" point. So if you perform a pivot rotation, you'll see the focus point being rotated, but you'll also see it being dragged. This is the correct behavior, but it isn't obvious.

We had a bug filed against our recognizer where the user didn't expect to see drag events when performing a pivot rotation. What they should have done is subscribed to just the rotate gesture events, since all they cared about was the rotation. I don't want to lead people to assume our stack is broken because they ran gesturetest without any arguments and saw behavior they didn't understand. Thus, I want to keep the functionality as is, potentially requiring the user to read the man page to understand what gesturetest is really doing.

Revision history for this message
Mohamed Amine Ilidrissi (ilidrissi.amine) wrote :

> I'll give an example that caused us issues. If you want to perform a rotation
> where one finger pivots around another, you will receive both rotation and
> drag events. The reason is that gestures are performed about a point in space.
> Our gesture system uses the center (average) of all the touch points as this
> "focus" point. So if you perform a pivot rotation, you'll see the focus point
> being rotated, but you'll also see it being dragged. This is the correct
> behavior, but it isn't obvious.
>
> We had a bug filed against our recognizer where the user didn't expect to see
> drag events when performing a pivot rotation. What they should have done is
> subscribed to just the rotate gesture events, since all they cared about was
> the rotation. I don't want to lead people to assume our stack is broken
> because they ran gesturetest without any arguments and saw behavior they
> didn't understand. Thus, I want to keep the functionality as is, potentially
> requiring the user to read the man page to understand what gesturetest is
> really doing.

Would an "--all-gestures" option do the trick? That way, the user knows that he is testing all the gestures at once.

Revision history for this message
Henrik Rydberg (rydberg) wrote :

I think the reasons for not including this change are really small. What you gain is the ability to see that *something* comes through in an easy way. For most people, that is that only thing they care about.

Regarding the completely different matter of rotation pivot, that bug is still valid, and the reasons for not confusing the center of the contacts with the pivot are still there. In the future, we will most likely see no drag events as one performs a rotation around a single finger, even if both types of events are listened to.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

I guess my underlying question is why we need this functionality. It seems to me that what we really need is a demo to show that gestures are working. Something graphical that you can manipulate. Gesturetest is not intended to show an end user that gestures are working properly. It is merely a developer's tool. This feels like trying to fit a round peg into a square hole.

Also, note that gesturetest will be dropped after Maverick anyways since gesture recognition will be performed client side instead of inside X. Geistest really is the utility you are after :).

Revision history for this message
Henrik Rydberg (rydberg) wrote :

Geistest is one layer further away from the source, and there are reasons to be able to test the presence of events on several checkpoints, this one included. And geistest would not be any easier to use with the same line of reasoning.

Revision history for this message
Chase Douglas (chasedouglas) wrote :

I still disagree as I think this may lead to sloppy coding. For example, adding 0 as a window parameter to gesturetest to listen on all windows has already led to an improper implementation of gestures in Unity. Unity currently listens for window specific gestures on all windows, including root, and uses the focus point to choose the correct window for manipulation. This is plain wrong, and only occurred because the gesturetest code had a path for doing this (gesturetest code was basically copied and pasted into Unity). Thus far, 1/1 gesture projects have used gesturetest and subsequently been written improperly :).

That said, I'm apparently in the minority and this isn't a huge deal. I'll merge this change in when I have a chance.

review: Approve
Revision history for this message
Mohamed Amine Ilidrissi (ilidrissi.amine) wrote :

> I still disagree as I think this may lead to sloppy coding. For example,
> adding 0 as a window parameter to gesturetest to listen on all windows has
> already led to an improper implementation of gestures in Unity. Unity
> currently listens for window specific gestures on all windows, including root,
> and uses the focus point to choose the correct window for manipulation. This
> is plain wrong, and only occurred because the gesturetest code had a path for
> doing this (gesturetest code was basically copied and pasted into Unity). Thus
> far, 1/1 gesture projects have used gesturetest and subsequently been written
> improperly :).
>
> That said, I'm apparently in the minority and this isn't a huge deal. I'll
> merge this change in when I have a chance.

Your opinion still counts, though. You shouldn't approve this just because everyone else is okay with it. That said, thanks :)

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Gesturetest is dead, so I'm rejecting this proposal.

Unmerged revisions

12. By Mohamed Amine Ilidrissi

Fixed the code.

11. By Rafi

Default args to 0 0 0xffffffffffffffff if no args are specified on the command
line. This should show all gestures that aren't caught by an application
(and fall through to the root window).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main.c'
2--- src/main.c 2010-08-12 09:43:29 +0000
3+++ src/main.c 2010-09-25 18:22:39 +0000
4@@ -40,42 +40,54 @@
5 uint32_t **mask) {
6 unsigned long long int tmp;
7 char *end;
8- int i;
9-
10- if (argc != 4) {
11- usage(argv[0]);
12- return -1;
13- }
14-
15- tmp = strtoul(argv[1], &end, 0);
16- if (*end != '\0' || tmp > UINT_MAX) {
17- usage(argv[0]);
18- return -1;
19- }
20- *window = (xcb_window_t)tmp;
21-
22- tmp = strtoul(argv[2], &end, 0);
23- if (*end != '\0' || tmp > USHRT_MAX) {
24- usage(argv[0]);
25- return -1;
26- }
27- *device_id = (uint16_t)tmp;
28-
29- tmp = strtoull(argv[3], &end, 0);
30- if (*end != '\0') {
31- usage(argv[0]);
32- return -1;
33- }
34- *mask_len = (tmp > UINT_MAX) ? 2 : 1;
35-
36- *mask = malloc(sizeof(uint32_t) * *mask_len);
37- if (!*mask) {
38- perror("Error: Failed to allocate event mask");
39- return -1;
40- }
41-
42- for (i = 0; i < *mask_len; i++)
43- (*mask)[i] = tmp >> (32 * i);
44+ int i;
45+
46+ switch(argc) {
47+ case 1:
48+ *window = (xcb_window_t)0;
49+ *device_id = (uint16_t)0;
50+ *mask_len = 2;
51+ *mask = malloc(sizeof(uint32_t) * *mask_len);
52+ (*mask)[0] = 0xffffffff;
53+ (*mask)[1] = 0xffffffff;
54+ break;
55+ case 4:
56+ tmp = strtoul(argv[1], &end, 0);
57+ if (*end != '\0' || tmp > UINT_MAX) {
58+ usage(argv[0]);
59+ return -1;
60+ }
61+ *window = (xcb_window_t)tmp;
62+
63+ tmp = strtoul(argv[2], &end, 0);
64+ if (*end != '\0' || tmp > USHRT_MAX) {
65+ usage(argv[0]);
66+ return -1;
67+ }
68+ *device_id = (uint16_t)tmp;
69+
70+ tmp = strtoull(argv[3], &end, 0);
71+ if (*end != '\0') {
72+ usage(argv[0]);
73+ return -1;
74+ }
75+ *mask_len = (tmp > UINT_MAX) ? 2 : 1;
76+
77+ *mask = malloc(sizeof(uint32_t) * *mask_len);
78+ if (!*mask) {
79+ perror("Error: Failed to allocate event mask");
80+ return -1;
81+ }
82+
83+ for (i = 0; i < *mask_len; i++)
84+ (*mask)[i] = tmp >> (32 * i);
85+
86+ break;
87+ default:
88+ usage(argv[0]);
89+ return -1;
90+ }
91+
92
93 return 0;
94 }

Subscribers

People subscribed via source and target branches