[PATCH weston 5/5] clients: Add simple draw client for testing pointer devices
Pekka Paalanen
ppaalanen at gmail.com
Wed May 9 23:45:15 PDT 2012
On Wed, 9 May 2012 23:31:46 +0200
Jonas Ådahl <jadahl at gmail.com> wrote:
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
> clients/Makefile.am | 4 ++
> clients/draw.c | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 201 insertions(+)
> create mode 100644 clients/draw.c
...
> + /* Paint buffer */
> + cairo_set_source_surface(cairo, draw->buffer,
> + allocation.x, allocation.y);
> +
> + cairo_rectangle(cairo,
> + allocation.x, allocation.y,
> + allocation.width, allocation.height);
> + cairo_clip(cairo);
> + cairo_paint(cairo);
> + cairo_reset_clip(cairo);
> +
> + /* Draw line between current pointer position and last */
> + if (draw->x != -1 && draw->y != -1) {
> + if (draw->old_x != -1 && draw->old_y != -1) {
> + cairo_set_line_width(cairo, 2.0);
> + cairo_set_source_rgb(cairo, 0, 0, 0);
> +
> + cairo_move_to(cairo, draw->old_x, draw->old_y);
> + cairo_line_to(cairo, draw->x, draw->y);
> + cairo_stroke(cairo);
> + }
> +
> + draw->old_x = draw->x;
> + draw->old_y = draw->y;
> + }
> +
> + /* Copy new content to buffer */
> + buffer_context = cairo_create(draw->buffer);
> + cairo_set_source_surface(buffer_context, surface,
> + -allocation.x, -allocation.y);
> + cairo_paint(buffer_context);
Hi,
I think it would be totally fine to just add these features into
clickdot. Draw and clickdot are very similar, right? It would fit the
purpose of clickdot.
Thanks,
pq
More information about the wayland-devel
mailing list