Mir

Merge lp:~vanvugt/mir/fingerpaint-touch-size into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alexandros Frantzis
Approved revision: no longer in the source branch.
Merged at revision: 3034
Proposed branch: lp:~vanvugt/mir/fingerpaint-touch-size
Merge into: lp:mir
Diff against target: 68 lines (+23/-5)
1 file modified
examples/fingerpaint.c (+23/-5)
To merge this branch: bzr merge lp:~vanvugt/mir/fingerpaint-touch-size
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Andreas Pokorny (community) Approve
Review via email: mp+274505@code.launchpad.net

Commit message

Fingerpaint: Use the actual touch size when painting. But also provide
a command line option to override it.

This provides better touch device support, and also acts as a workaround
for both LP: #1354254 and LP: #1487366 so fingerpaint is now usable under
Unity8 (if you remember -w to workaround LP: #1497828 too).

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

At least on some devices it seemed that multiplying with a per device constant gets consistently closer to the actual size. Mild suggestion: You could add a multiplication parameter to the tool, and we could at some point add that to the udev hwdb.. (if we ever manage to identify the touch screen reliably)

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

lgtm

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/fingerpaint.c'
2--- examples/fingerpaint.c 2015-08-25 02:27:09 +0000
3+++ examples/fingerpaint.c 2015-10-19 05:47:59 +0000
4@@ -42,6 +42,7 @@
5 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
6 static pthread_cond_t change = PTHREAD_COND_INITIALIZER;
7 static bool changed = true;
8+static int force_radius = 0;
9
10 static void shutdown(int signum)
11 {
12@@ -263,11 +264,13 @@
13 {
14 x = mir_touch_event_axis_value(tev, p, mir_touch_axis_x);
15 y = mir_touch_event_axis_value(tev, p, mir_touch_axis_y);
16- float size = mir_touch_event_axis_value(tev, p,
17- mir_touch_axis_size);
18+ float m = mir_touch_event_axis_value(tev, p,
19+ mir_touch_axis_touch_major);
20+ float n = mir_touch_event_axis_value(tev, p,
21+ mir_touch_axis_touch_minor);
22+ radius = (m + n) / 4; /* Half the average */
23 pressure = mir_touch_event_axis_value(tev, p,
24 mir_touch_axis_pressure);
25- radius = size * 50.0f + 1.0f;
26 }
27 else if (pev != NULL)
28 {
29@@ -277,6 +280,9 @@
30 radius = 5;
31 }
32
33+ if (force_radius)
34+ radius = force_radius;
35+
36 size_t c = (base_color + p) %
37 (sizeof(color)/sizeof(color[0]));
38 Color tone = color[c];
39@@ -365,7 +371,18 @@
40 switch (arg[1])
41 {
42 case 'm':
43- mir_socket = argv[++i];
44+ ++i;
45+ if (i < argc)
46+ mir_socket = argv[i];
47+ else
48+ help = 1;
49+ break;
50+ case 'r':
51+ ++i;
52+ if (i < argc)
53+ force_radius = atoi(argv[i]);
54+ else
55+ help = 1;
56 break;
57 case 'w':
58 swap_interval = 1;
59@@ -385,7 +402,8 @@
60 {
61 printf("Usage: %s [<options>]\n"
62 " -h Show this help text\n"
63- " -m socket Mir server socket\n"
64+ " -m <socket path> Mir server socket\n"
65+ " -r <radius> Force paint brush radius\n"
66 " -w Wait for vblank (don't drop frames)\n"
67 " -- Ignore further arguments\n"
68 , argv[0]);

Subscribers

People subscribed via source and target branches