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
=== modified file 'examples/fingerpaint.c'
--- examples/fingerpaint.c 2015-08-25 02:27:09 +0000
+++ examples/fingerpaint.c 2015-10-19 05:47:59 +0000
@@ -42,6 +42,7 @@
42static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;42static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
43static pthread_cond_t change = PTHREAD_COND_INITIALIZER;43static pthread_cond_t change = PTHREAD_COND_INITIALIZER;
44static bool changed = true;44static bool changed = true;
45static int force_radius = 0;
4546
46static void shutdown(int signum)47static void shutdown(int signum)
47{48{
@@ -263,11 +264,13 @@
263 {264 {
264 x = mir_touch_event_axis_value(tev, p, mir_touch_axis_x);265 x = mir_touch_event_axis_value(tev, p, mir_touch_axis_x);
265 y = mir_touch_event_axis_value(tev, p, mir_touch_axis_y);266 y = mir_touch_event_axis_value(tev, p, mir_touch_axis_y);
266 float size = mir_touch_event_axis_value(tev, p,267 float m = mir_touch_event_axis_value(tev, p,
267 mir_touch_axis_size);268 mir_touch_axis_touch_major);
269 float n = mir_touch_event_axis_value(tev, p,
270 mir_touch_axis_touch_minor);
271 radius = (m + n) / 4; /* Half the average */
268 pressure = mir_touch_event_axis_value(tev, p,272 pressure = mir_touch_event_axis_value(tev, p,
269 mir_touch_axis_pressure);273 mir_touch_axis_pressure);
270 radius = size * 50.0f + 1.0f;
271 }274 }
272 else if (pev != NULL)275 else if (pev != NULL)
273 {276 {
@@ -277,6 +280,9 @@
277 radius = 5;280 radius = 5;
278 }281 }
279282
283 if (force_radius)
284 radius = force_radius;
285
280 size_t c = (base_color + p) %286 size_t c = (base_color + p) %
281 (sizeof(color)/sizeof(color[0]));287 (sizeof(color)/sizeof(color[0]));
282 Color tone = color[c];288 Color tone = color[c];
@@ -365,7 +371,18 @@
365 switch (arg[1])371 switch (arg[1])
366 {372 {
367 case 'm':373 case 'm':
368 mir_socket = argv[++i];374 ++i;
375 if (i < argc)
376 mir_socket = argv[i];
377 else
378 help = 1;
379 break;
380 case 'r':
381 ++i;
382 if (i < argc)
383 force_radius = atoi(argv[i]);
384 else
385 help = 1;
369 break;386 break;
370 case 'w':387 case 'w':
371 swap_interval = 1;388 swap_interval = 1;
@@ -385,7 +402,8 @@
385 {402 {
386 printf("Usage: %s [<options>]\n"403 printf("Usage: %s [<options>]\n"
387 " -h Show this help text\n"404 " -h Show this help text\n"
388 " -m socket Mir server socket\n"405 " -m <socket path> Mir server socket\n"
406 " -r <radius> Force paint brush radius\n"
389 " -w Wait for vblank (don't drop frames)\n"407 " -w Wait for vblank (don't drop frames)\n"
390 " -- Ignore further arguments\n"408 " -- Ignore further arguments\n"
391 , argv[0]);409 , argv[0]);

Subscribers

People subscribed via source and target branches