[PATCH] Bug fix client apps because of output change

Pekka Paalanen ppaalanen at gmail.com
Mon Mar 10 04:05:28 PDT 2014


On Mon, 10 Mar 2014 10:58:00 +0000
"Wang, Quanxian" <quanxian.wang at intel.com> wrote:

> 
> 
> >-----Original Message-----
> >From: Pekka Paalanen [mailto:ppaalanen at gmail.com]
> >Sent: Monday, March 10, 2014 5:58 PM
> >To: Wang, Quanxian
> >Cc: wayland-devel at lists.freedesktop.org
> >Subject: Re: [PATCH] Bug fix client apps because of output change
> >
> >On Mon, 10 Mar 2014 08:23:45 +0000
> >"Wang, Quanxian" <quanxian.wang at intel.com> wrote:
> >
> >> Thanks Pq. Comments below.
> >...
> >> >> @@ -1145,6 +1154,45 @@ desktop_destroy_outputs(struct desktop
> >> >> *desktop) }
> >> >>
> >> >>  static void
> >> >> +update_output(struct output *output) {
> >> >> +	struct panel *panel = output->panel;
> >> >> +	struct background *background = output->background;
> >> >> +	int width, height;
> >> >> +
> >> >> +	if (!output)
> >> >
> >> >You already dereferenced 'output' above, checking for NULL here is
> >> >useless. 'output' can never be NULL anyway, right?
> >> [Wang, Quanxian] right.
> >> >
> >> >> +		return;
> >> >> +
> >> >> +	width = output->mode.width;
> >> >> +	height = output->mode.height;
> >> >> +
> >> >> +	switch (output->transform) {
> >> >> +	case WL_OUTPUT_TRANSFORM_90:
> >> >> +	case WL_OUTPUT_TRANSFORM_270:
> >> >> +	case WL_OUTPUT_TRANSFORM_FLIPPED_90:
> >> >> +	case WL_OUTPUT_TRANSFORM_FLIPPED_270:
> >> >> +		/* Swap width and height */
> >> >> +		width = output->mode.height;
> >> >> +		height = output->mode.width;
> >> >> +		break;
> >> >> +	default:
> >> >> +		break;
> >> >> +	}
> >> >> +
> >> >> +	if (output->scale != 0) {
> >> >
> >> >If scale was initialized to 1, there would be no need for 'if'.
> >> >Right?
> >> [Wang, Quanxian] in testing, this cause the error because scale is set
> >> to 0, it happens when weston is started at the very beginning.
> >> Here we need to do that.
> >
> >Why does that happen? Is Weston sending an event with scale=0? If so, then that
> >is a Weston bug and should be fixed. Until you get any event the scale is 1,
> >because that is the implicit scale in interface version 1.
> [Wang, Quanxian] yes. Got geometry event with scale=0.

What do you mean? wl_output.geometry does not carry scale at all, hence
until you receive the first wl_output.scale you should assume scale=1.
The easiest way to do that is to initialize output::scale to 1 in
create_output(). You should never have zero.


Thanks,
pq


More information about the wayland-devel mailing list