XDestroyWindow can not really close the window

Alan Coopersmith alan.coopersmith at oracle.com
Fri May 11 01:23:08 UTC 2018


On 05/10/18 06:17 PM, pengyixiang wrote:
> Hello, everyone!
>     I'm a newbie in xlib, I need to close the window while won't close the
> program, [1] is my test code, here's the result in [2], XDestroyWindow passed,
> but the window haven't close, Haven't I get the key to code it?

XDestroyWindow() just puts the request in the Xlib buffer but does not send
it to the X server.

You need to put an XFlush() before the infinite sched_yield loop to cause it to
be sent to the server, or remove the infinite sched_yield loop to allow the
program to loop back around to the XNextEvent() call which also flushes the
Xlib request buffer.  (Though then you'll end up in an infinite error loop
trying to destroy already destroyed windows.)


-- 
	-Alan Coopersmith-               alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc


More information about the xorg mailing list