[PATCH 3/2 weston] clickdot: Add --debug option to preserve useful behavior.

Pekka Paalanen ppaalanen at gmail.com
Fri Nov 9 01:46:33 PST 2012


On Fri,  9 Nov 2012 02:20:33 -0700
Scott Moreau <oreaus at gmail.com> wrote:

> ---
> 
> Hi Pekka,
> 
> Thanks for the review. Here is a patch that could be applied on top to
> preserve the original behavior.

Hello Scott,

ok, then you should probably make the debug mode the default, but what
is the purpose of the non-debug mode?

Your original patch didn't explain why you want to change this, and
it's not obvious to me.


Thanks,
pq

>  clients/clickdot.c | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/clients/clickdot.c b/clients/clickdot.c
> index b04db6b..9e3def0 100644
> --- a/clients/clickdot.c
> +++ b/clients/clickdot.c
> @@ -52,7 +52,7 @@ struct clickdot {
>  		int32_t old_x, old_y;
>  	} line;
>  
> -	int reset, clicked;
> +	int reset, clicked, debug;
>  };
>  
>  static void
> @@ -153,14 +153,18 @@ redraw_handler(struct widget *widget, void *data)
>  	cairo_set_source_rgba(cr, 0, 0, 0, 0.8);
>  	cairo_fill(cr);
>  
> -	if (clickdot->clicked)
> +	if (clickdot->debug)
>  		draw_line(clickdot, cr, &allocation);
> -	else if (clickdot->buffer) {
> -		cairo_surface_destroy(clickdot->buffer);
> -		clickdot->buffer =
> -			cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
> -						   allocation.width,
> -						   allocation.height);
> +	else {
> +		if (clickdot->clicked)
> +			draw_line(clickdot, cr, &allocation);
> +		else if (clickdot->buffer) {
> +			cairo_surface_destroy(clickdot->buffer);
> +			clickdot->buffer =
> +				cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
> +							   allocation.width,
> +							   allocation.height);
> +		}
>  	}
>  
>  	window_get_allocation(clickdot->window, &window);
> @@ -225,7 +229,8 @@ button_handler(struct widget *widget,
>  		clickdot->dot.rh = (float) clickdot->dot.y / allocation.height;
>  		clickdot->clicked = 1;
>  	} else {
> -		clickdot->reset = 1;
> +		if (!clickdot->debug)
> +			clickdot->reset = 1;
>  		clickdot->clicked = 0;
>  	}
>  
> @@ -330,6 +335,9 @@ main(int argc, char *argv[])
>  
>  	clickdot = clickdot_create(display);
>  
> +	if (argc > 1 && !strcmp(argv[1], "--debug"))
> +		clickdot->debug = 1;
> +
>  	display_run(display);
>  
>  	clickdot_destroy(clickdot);



More information about the wayland-devel mailing list