[PATCH weston 5/5] clients: Add simple draw client for testing pointer devices

Kristian Høgsberg hoegsberg at gmail.com
Thu May 10 14:00:23 PDT 2012


On Thu, May 10, 2012 at 09:45:15AM +0300, Pekka Paalanen wrote:
> 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.

Yeah, I think we could combine the two into one application.  I like
what draw.c does but I think we can just add that to clickdot.c.

Kristian


More information about the wayland-devel mailing list