[PATCH rendercheck] Use the right screen from $DISPLAY

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Aug 1 14:24:10 PDT 2011


Looks about right...

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Aug 1, 2011, at 12:34, Aaron Plattner wrote:

> RootWindow(dpy, 0) always uses screen 0, even if a different screen is
> specified in the $DISPLAY environment variable.  Use
> DefaultRootWindow(dpy) instead to use the right one.
> ---
> main.c          |    4 ++--
> t_bug7366.c     |    2 +-
> t_repeat.c      |    2 +-
> t_srccoords.c   |    2 +-
> t_tsrccoords.c  |    2 +-
> t_tsrccoords2.c |    2 +-
> tests.c         |   12 ++++++------
> 7 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/main.c b/main.c
> index e261c78..5190c49 100644
> --- a/main.c
> +++ b/main.c
> @@ -289,8 +289,8 @@ int main(int argc, char **argv)
> 		num_ops = PictOpSaturate;
> 	}
> 
> -	window.d = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0, win_width,
> -	    win_height, 0, 0, WhitePixel(dpy, 0));
> +	window.d = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
> +	    win_width, win_height, 0, 0, WhitePixel(dpy, 0));
> 
> 	as.override_redirect = True;
> 	XChangeWindowAttributes(dpy, window.d, CWOverrideRedirect, &as);
> diff --git a/t_bug7366.c b/t_bug7366.c
> index 1277580..34ac004 100644
> --- a/t_bug7366.c
> +++ b/t_bug7366.c
> @@ -69,7 +69,7 @@ bug7366_test_set_alpha_map(Display *dpy)
>     memset(&color, 0, sizeof(color));
>     source_pict = XRenderCreateSolidFill(dpy, &color);
> 
> -    pixmap = XCreatePixmap(dpy, RootWindow(dpy, 0), 1, 1, 32);
> +    pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), 1, 1, 32);
>     pict = XRenderCreatePicture(dpy, pixmap,
>         XRenderFindStandardFormat(dpy, PictStandardARGB32), 0, NULL);
> 
> diff --git a/t_repeat.c b/t_repeat.c
> index 4e26136..679bca1 100644
> --- a/t_repeat.c
> +++ b/t_repeat.c
> @@ -69,7 +69,7 @@ repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op,
> 		pa.component_alpha = test_mask;
> 		pa.repeat = TRUE;
> 
> -		src.d = XCreatePixmap(dpy, RootWindow(dpy, 0), w, h, 32);
> +		src.d = XCreatePixmap(dpy, DefaultRootWindow(dpy), w, h, 32);
> 		src.format = XRenderFindStandardFormat(dpy, PictStandardARGB32);
> 		src.pict = XRenderCreatePicture(dpy, src.d, src.format,
> 		    CPComponentAlpha | CPRepeat, &pa);
> diff --git a/t_srccoords.c b/t_srccoords.c
> index 6aff6d5..6e29e8a 100644
> --- a/t_srccoords.c
> +++ b/t_srccoords.c
> @@ -43,7 +43,7 @@ static picture_info *create_target_picture(Display *dpy)
> 
> 	p = malloc(sizeof(picture_info));
> 
> -	p->d = XCreatePixmap(dpy, RootWindow(dpy, 0), 5, 5, 32);
> +	p->d = XCreatePixmap(dpy, DefaultRootWindow(dpy), 5, 5, 32);
> 	p->format = XRenderFindStandardFormat(dpy, PictStandardARGB32);
> 	p->pict = XRenderCreatePicture(dpy, p->d, p->format, 0, NULL);
> 	p->name = "target picture";
> diff --git a/t_tsrccoords.c b/t_tsrccoords.c
> index 124fdc9..279591d 100644
> --- a/t_tsrccoords.c
> +++ b/t_tsrccoords.c
> @@ -43,7 +43,7 @@ static picture_info *create_dot_picture(Display *dpy)
> 
> 	p = malloc(sizeof(picture_info));
> 
> -	p->d = XCreatePixmap(dpy, RootWindow(dpy, 0), 5, 5, 32);
> +	p->d = XCreatePixmap(dpy, DefaultRootWindow(dpy), 5, 5, 32);
> 	p->format = XRenderFindStandardFormat(dpy, PictStandardARGB32);
> 	p->pict = XRenderCreatePicture(dpy, p->d, p->format, 0, NULL);
> 	p->name = "dot picture";
> diff --git a/t_tsrccoords2.c b/t_tsrccoords2.c
> index 4449dca..0d83fd5 100644
> --- a/t_tsrccoords2.c
> +++ b/t_tsrccoords2.c
> @@ -43,7 +43,7 @@ static picture_info *create_target_picture(Display *dpy)
> 
> 	p = malloc(sizeof(picture_info));
> 
> -	p->d = XCreatePixmap(dpy, RootWindow(dpy, 0), 5, 5, 32);
> +	p->d = XCreatePixmap(dpy, DefaultRootWindow(dpy), 5, 5, 32);
> 	p->format = XRenderFindStandardFormat(dpy, PictStandardARGB32);
> 	p->pict = XRenderCreatePicture(dpy, p->d, p->format, 0, NULL);
> 	p->name = "target picture";
> diff --git a/tests.c b/tests.c
> index def1bf5..aacd14d 100644
> --- a/tests.c
> +++ b/tests.c
> @@ -337,7 +337,7 @@ do_tests(Display *dpy, picture_info *win)
> 
> 	for (i = 0; i < num_dests; i++) {
> 		dests[i].format = format_list[i];
> -		dests[i].d = XCreatePixmap(dpy, RootWindow(dpy, 0),
> +		dests[i].d = XCreatePixmap(dpy, DefaultRootWindow(dpy),
> 		    win_width, win_height, dests[i].format->depth);
> 		dests[i].pict = XRenderCreatePicture(dpy, dests[i].d,
> 		    dests[i].format, 0, NULL);
> @@ -359,8 +359,8 @@ do_tests(Display *dpy, picture_info *win)
> 
> 		/* The standard PictFormat numbers go from 0 to 4 */
> 		pictures_1x1[i].format = format_list[i % nformats];
> -		pictures_1x1[i].d = XCreatePixmap(dpy, RootWindow(dpy, 0), 1,
> -		    1, pictures_1x1[i].format->depth);
> +		pictures_1x1[i].d = XCreatePixmap(dpy, DefaultRootWindow(dpy),
> +		    1, 1, pictures_1x1[i].format->depth);
> 		pa.repeat = TRUE;
> 		pictures_1x1[i].pict = XRenderCreatePicture(dpy,
> 		    pictures_1x1[i].d, pictures_1x1[i].format, CPRepeat, &pa);
> @@ -395,8 +395,8 @@ do_tests(Display *dpy, picture_info *win)
> 
> 		/* The standard PictFormat numbers go from 0 to 4 */
> 		pictures_10x10[i].format = format_list[i % nformats];
> -		pictures_10x10[i].d = XCreatePixmap(dpy, RootWindow(dpy, 0), 10,
> -		    10, pictures_10x10[i].format->depth);
> +		pictures_10x10[i].d = XCreatePixmap(dpy, DefaultRootWindow(dpy),
> +		    10, 10, pictures_10x10[i].format->depth);
> 		pa.repeat = TRUE;
> 		pictures_10x10[i].pict = XRenderCreatePicture(dpy,
> 		    pictures_10x10[i].d, pictures_10x10[i].format, 0, NULL);
> @@ -416,7 +416,7 @@ do_tests(Display *dpy, picture_info *win)
> 		color_correct(&pictures_10x10[i], &pictures_10x10[i].color);
> 	}
> 
> -	picture_3x3.d = XCreatePixmap(dpy, RootWindow(dpy, 0), 3, 3, 32);
> +	picture_3x3.d = XCreatePixmap(dpy, DefaultRootWindow(dpy), 3, 3, 32);
> 	picture_3x3.format = XRenderFindStandardFormat(dpy, PictStandardARGB32);
> 	picture_3x3.pict = XRenderCreatePicture(dpy, picture_3x3.d,
> 	    picture_3x3.format, 0, NULL);
> -- 
> 1.7.4.1
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list