Patch looks good to me. > as the XUngrabKey() there effectively does nothing.
For the record, I don't think *anything* inside cleanup() does anything that process termination wouldn't have done already. XCloseDisplay() might be the only thing in there doing any useful work; from the manpage: Before exiting, you should call XCloseDisplay explicitly so that any pending errors are reported as XCloseDisplay performs a final XSync operation. This also makes me realize, the XSync() call right before XCloseDisplay() is probably redundant. But in any case, those are different topics. The patch you sent does what it claims and is worth merging as far as I'm concerned. - NRK