diff options
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/window.c b/src/window.c index 1ccd0521..f638a9f4 100644 --- a/src/window.c +++ b/src/window.c @@ -1425,6 +1425,7 @@ bindWindow (CompWindow *w) if (!w->pixmap) { XWindowAttributes attr; + Display *dpy = w->screen->display->display; /* don't try to bind window again if it failed previously */ if (w->bindFailed) @@ -1432,20 +1433,20 @@ bindWindow (CompWindow *w) /* We have to grab the server here to make sure that window is mapped when getting the window pixmap */ - XGrabServer (w->screen->display->display); - XGetWindowAttributes (w->screen->display->display, w->id, &attr); - if (attr.map_state != IsViewable) + XGrabServer (dpy); + + if (!XGetWindowAttributes (dpy, w->id, &attr) || + attr.map_state != IsViewable) { - XUngrabServer (w->screen->display->display); + XUngrabServer (dpy); finiTexture (w->screen, w->texture); w->bindFailed = TRUE; return FALSE; } - w->pixmap = XCompositeNameWindowPixmap (w->screen->display->display, - w->id); + w->pixmap = XCompositeNameWindowPixmap (dpy, w->id); - XUngrabServer (w->screen->display->display); + XUngrabServer (dpy); } if (!bindPixmapToTexture (w->screen, w->texture, w->pixmap, |