diff options
-rw-r--r-- | src/rmd_setbrwindow.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/rmd_setbrwindow.c b/src/rmd_setbrwindow.c index 846abe6..08d0997 100644 --- a/src/rmd_setbrwindow.c +++ b/src/rmd_setbrwindow.c @@ -63,11 +63,15 @@ boolean rmdSetBRWindow( Display *dpy, Window wchid; XWindowAttributes attribs; + XSelectInput(dpy, args->windowid, VisibilityChangeMask | StructureNotifyMask); XGetWindowAttributes(dpy, args->windowid, &attribs); - if (attribs.map_state == IsUnviewable || attribs.map_state == IsUnmapped) { - fprintf(stderr, "Window must be mapped and visible!\n"); - return FALSE; + while (attribs.map_state == IsUnviewable || attribs.map_state == IsUnmapped) { + XEvent ev; + + fprintf(stderr, "Waiting for window to be mapped and visible!\n"); + XWindowEvent(dpy, args->windowid, VisibilityChangeMask|StructureNotifyMask, &ev); + XGetWindowAttributes(dpy, args->windowid, &attribs); } XTranslateCoordinates( dpy, |