[PATCH xwayland 1/2] xwayland: Update actual screen and root window size on output hot plug

Jonas Ådahl jadahl at gmail.com
Wed Oct 7 06:57:19 PDT 2015


On Wed, Oct 07, 2015 at 12:09:17PM +0100, Daniel Stone wrote:
> Hi Jonas,
> 
> On 7 October 2015 at 05:02, Jonas Ådahl <jadahl at gmail.com> wrote:
> > When a new output is hot-plugged we need to not only update our internal
> > screen dimensions, but also the dix screen dimensions, screenInfo
> > dimensions and the root window dimensions.
> >
> > https://bugs.freedesktop.org/show_bug.cgi?id=92273
> >
> > Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> > ---
> >  hw/xwayland/xwayland-output.c | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
> > index 923f368..a8c2f2e 100644
> > --- a/hw/xwayland/xwayland-output.c
> > +++ b/hw/xwayland/xwayland-output.c
> > @@ -156,9 +156,22 @@ output_handle_done(void *data, struct wl_output *wl_output)
> >         --xwl_screen->expecting_event;
> >      }
> >
> > +    if (xwl_screen->screen->root)
> > +        SetRootClip(xwl_screen->screen, FALSE);
> > +
> >      xwl_screen->width = width;
> >      xwl_screen->height = height;
> > -    RRScreenSizeNotify(xwl_screen->screen);
> > +    xwl_screen->screen->width = width;
> > +    xwl_screen->screen->height = height;
> > +
> > +    if (xwl_screen->screen->root) {
> > +        xwl_screen->screen->root->drawable.width = width;
> > +        xwl_screen->screen->root->drawable.height = height;
> > +        SetRootClip(xwl_screen->screen, TRUE);
> > +        RRScreenSizeNotify(xwl_screen->screen);
> > +    }
> > +
> > +    update_desktop_dimensions();
> >  }
> >
> >  static void
> 
> Thanks, looks good to me. I had a half-complete version of the same,
> but just forgot to update the root-clip, hence why it didn't work.

It is thanks to Olivier that the SetRootClip calls is there. It was quite
hard to spot that it was necessary.

> One
> thing I did notice from the earlier iteration though, is that for me,
> I was seeing this being called when xwl_screen->screen is NULL, thus a
> segfault on startup. Are you not seeing the same?

I got a segfault if I didn't NULL check the root window of the screen,
because the root window is initialized later than the outputs are in
dix_main().

But since we get the Wayland registry and discover the outputs after we
set xwl_screen->screen ScreenPtr in xwl_screen_init(), we can be sure its
always non-NULL.

> 
> Assuming this is tested and working, then for the series:
> Reviewed-by: Daniel Stone <daniels at collabora.com>

Thanks,


Jonas

> 
> Cheers,
> Daniel


More information about the xorg-devel mailing list