You need to handle WM_DELETE_WINDOW message that icccm-compliant window manager sends to client before closing it's window. After last top level window is closed connection to X server is usually closed by server.
XPending() reports error on window close
Question
In a call to XPending()
I get following error message in terminal:
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
This happens after I click the close button on the window (the cross in the corner).
Otherwise the program works fine. I suggest when I click the close button, the window manager will abruptly disconnect my app from the XServer. So the connection is no longer active and XPending returns an error. Can I somehow check if connection is still active or not prior to calling XPending()
? What is a recommended "good practice" here?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow