[waffle] [PATCH] x11: fix for a non-zero default screen

Emil Velikov emil.l.velikov at gmail.com
Wed Aug 20 07:11:40 PDT 2014


On 19/08/14 23:10, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
Marek you have my vote if you ever run for a president, going through mesa and
waffle to fix this - you're a star :)

Must admit that I don't have much experience with xcb but the patch looks
straightforward enough.
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

> ---
>  src/waffle/x11/x11_window.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/src/waffle/x11/x11_window.c b/src/waffle/x11/x11_window.c
> index 582cc02..b2e3631 100644
> --- a/src/waffle/x11/x11_window.c
> +++ b/src/waffle/x11/x11_window.c
> @@ -53,6 +53,19 @@ x11_winddow_get_depth(xcb_connection_t *conn,
>      return 0;
>  }
>  
> +static xcb_screen_t *
> +get_xcb_screen(const xcb_setup_t *setup, int screen)
> +{
> +    xcb_screen_iterator_t iter;
> +
> +    iter = xcb_setup_roots_iterator(setup);
> +    for (; iter.rem; --screen, xcb_screen_next(&iter))
> +        if (screen == 0)
> +            return iter.data;
> +
> +    return NULL;
> +}
> +
>  bool
>  x11_window_init(struct x11_window *self,
>                  struct x11_display *dpy,
> @@ -75,7 +88,7 @@ x11_window_init(struct x11_window *self,
>          goto error;
>      }
>  
> -    const xcb_screen_t *screen = xcb_setup_roots_iterator(setup).data;
> +    const xcb_screen_t *screen = get_xcb_screen(setup, dpy->screen);
>      if (!screen) {
>          wcore_errorf(WAFFLE_ERROR_UNKNOWN, "failed to get xcb screen");
>          goto error;
> 



More information about the waffle mailing list