[comp.windows.x] Getting rid of windows

wmam@sphinx.UUCP (03/14/87)

I wrote a cute little program that, when given a time (either absolute or as
a number of minuites) would go away and wake up to display a message at the
top of the screen.  The problem is that I attempted to program it for a
"reset" mode where you would click on it and it would come back in five
minuites to give you another warning.  What I don't seem to be able to do is
get rid of the window.  I am unmapping and destroying it with
XDestroyWindow() (and I tried XUnmapWindow() in conjunction) as well as
attempting an XChangeBackground call on the root window.  It doesn't do any
good.  Any hints anyone would have would be greatly appreciated...

Thanks in advance!

-- 
Tony Mason
University of Chicago, Dept. of Computer Science
uucp:  ...ihnp4!gargoyle!{mason,sphinx!wmam,anubis!mason}
ARPA:  mason@{anubis,gargoyle}.uchicago.edu

swick@ATHENA.MIT.EDU (Ralph R. Swick) (03/16/87)

Mistakes of this nature are common to programmers unfamiliar with server-client
designs, thus I am sending my reply to the entire list.

If your XUnmapWindow() is followed immediately by the sleep() (or variant),
then the request is never actually getting out to the server.  You need to use
XSync() to make sure all requests and replies are processed before sleeping.

It will be possible in the next Xlib to disable the buffering of requests so
as to ease debugging of applications.  This effect will probably still catch
the unwary, however.

-Ralph

swick@ATHENA.MIT.EDU (Ralph R. Swick) (03/17/87)

>>[The asynchronous nature of client-server communications] will probably
>>still catch the unwary, however.

>An application that doesn't call XSync() when it should has a bug, and
>turning off buffering during debugging allows this bug to go undetected.

Exactly my point.  Synchronous mode _will_ help you by not requiring extra
XSync() calls after every request when you are trying to figure out on which
argument of which call you made an error.

-Ralph R. Swick
 DEC/MIT Project Athena