[PATCH 1/2] xwayland: Update screen size on output removal

Pekka Paalanen ppaalanen at gmail.com
Sun Nov 15 23:55:16 PST 2015


On Fri, 13 Nov 2015 17:57:22 +0100
Olivier Fourdan <ofourdan at redhat.com> wrote:

> When unplugging an output, it's still listed in xrandr and the size
> of the root window still includes the removed output.
> 
> The XRandR output should be destroyed when its Wayland counterpart is
> destroyed and the screen dimensions must be updated in both the done
> and the destroy handler.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92914
> Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
> ---
>  hw/xwayland/xwayland-output.c | 149 ++++++++++++++++++++++++------------------
>  1 file changed, 85 insertions(+), 64 deletions(-)
> 
> diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
> index e4623d4..39893e7 100644
> --- a/hw/xwayland/xwayland-output.c
> +++ b/hw/xwayland/xwayland-output.c
> @@ -76,6 +76,76 @@ wl_subpixel_to_xrandr(int subpixel)
>      }
>  }
>  
> +static inline void
> +output_get_new_size(struct xwl_output *xwl_output, int *height, int *width)
> +{
> +    if (*width < xwl_output->x + xwl_output->width)
> +        *width = xwl_output->x + xwl_output->width;
> +
> +    if (*height < xwl_output->y + xwl_output->height)
> +        *height = xwl_output->y + xwl_output->height;
> +}

Hi Olivier,

I see that the above is old code just moved and I don't really know
how Xwayland works here, but that code looks strange to me. I don't
know what useful meaning wl_output's x+width or y+height have wrt. size
- all it gives you is the lower-right corner of the wl_output in some
arbitrary coordinate system.

I suppose an example highlights my worry:

Say there is a wl_output at x=0, y=0 and width=1600, height=1200. Then
there is a new output hotplugged to the left of the first output. If
the new output is 800x600, I would expect a Wayland compositor for the
wl_output to set x=-800, y=0, width=800, height=600[*]. This then results
in x+width = 0.

Could Xwayland have a problem with that?

Or does Xwayland perhaps have a requirement for compositors to have
no output space to the left and/or right of 0,0?

We have also entertained a thought to position the first output in
Weston not to x=0, y=0 but somewhere totally different like x=-3000,
y=2000 and see what would break, but I'm not sure if anyone tried it
yet. In theory it should not make any difference.


[*] Why? So it does not need to move all existing outputs, which would
lead to sending geometry events for all outputs rather than just one,
and perhaps updating the internal position of every wl_surface.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20151116/3355806f/attachment.sig>


More information about the xorg-devel mailing list