From: Peter Hutterer Date: Thu, 31 Oct 2019 22:20:07 +0000 (+1000) Subject: tools: debug-gui: show pressure/distance as vertical bar X-Git-Tag: 1.14.901~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12021c860e796a9f28f3f47c2ff04f171e0846d6;p=platform%2Fupstream%2Flibinput.git tools: debug-gui: show pressure/distance as vertical bar Both of these are normalized so let's draw a bar that shows the values accordingly. This makes it a lot easier to check whether pressure values go to the maximum, etc. A little extra square is shown whenever the tip is logically down. Signed-off-by: Peter Hutterer --- diff --git a/tools/libinput-debug-gui.c b/tools/libinput-debug-gui.c index ea31e178..516d8c48 100644 --- a/tools/libinput-debug-gui.c +++ b/tools/libinput-debug-gui.c @@ -139,6 +139,7 @@ struct window { double tilt_x, tilt_y; double rotation; double size_major, size_minor; + bool is_down; /* these are for the delta coordinates, but they're not * deltas, they are converted into abs positions */ @@ -535,6 +536,30 @@ draw_tablet(struct window *w, cairo_t *cr) double x, y; int first, last; size_t mask; + int rx, ry; + + /* pressure/distance bars */ + rx = w->width/2 + 100; + ry = w->height/2 + 50; + cairo_save(cr); + cairo_set_source_rgb(cr, .2, .6, .6); + cairo_rectangle(cr, rx, ry, 20, 100); + cairo_stroke(cr); + + if (w->tool.distance > 0) { + double pos = w->tool.distance * 100; + cairo_rectangle(cr, rx, ry + 100 - pos, 20, 5); + cairo_fill(cr); + } + if (w->tool.pressure > 0) { + double pos = w->tool.pressure * 100; + if (w->tool.is_down) + cairo_rectangle(cr, rx + 25, ry + 95, 5, 5); + cairo_rectangle(cr, rx, ry + 100 - pos, 20, pos); + cairo_fill(cr); + } + cairo_restore(cr); + /* tablet tool, square for prox-in location */ cairo_save(cr); @@ -1309,9 +1334,11 @@ handle_event_tablet(struct libinput_event *ev, struct window *w) LIBINPUT_TABLET_TOOL_TIP_DOWN) { w->tool.x_down = x; w->tool.y_down = y; + w->tool.is_down = true; } else { w->tool.x_up = x; w->tool.y_up = y; + w->tool.is_down = false; } /* fallthrough */ case LIBINPUT_EVENT_TABLET_TOOL_AXIS: diff --git a/tools/libinput-debug-gui.man b/tools/libinput-debug-gui.man index 3a1b2957..5b03ec41 100644 --- a/tools/libinput-debug-gui.man +++ b/tools/libinput-debug-gui.man @@ -73,11 +73,13 @@ respectively, at the touch point or absolute position. .B Tablet tools Events from tablet tools show a cyan square at the proximity-in and proximity-out positions. The tool position is shown as circle and increases -in radius with increasing pressure or distance. Where tilt is available, the -circle changes to an ellipsis to indicate the tilt angle. Relative events -from the tablet tool are displayed as a yellow snake, always starting from -the center of the window on proximity in. Button events are displayed in the -bottom-most button oblong, with the name of the button displayed on press. +in radius with increasing pressure or distance. Pressure and distance are +also shown in the vertical bar south-east of center. Where tilt is +available, the circle changes to an ellipsis to indicate the tilt angle. +Relative events from the tablet tool are displayed as a yellow snake, always +starting from the center of the window on proximity in. Button events are +displayed in the bottom-most button oblong, with the name of the button +displayed on press. .TP 8 .B Tablet pads Button events are displayed in the bottom-most button oblong, with the name