private IntPtr XGetParent(IntPtr handle) {
IntPtr Root;
IntPtr Parent;
IntPtr Children;
int ChildCount;
lock (XlibLock) {
XQueryTree(DisplayHandle, handle, out Root, out Parent, out Children, out ChildCount);
}
if (Children!=IntPtr.Zero) {
lock (XlibLock) {
XFree(Children);
}
}
return Parent;
}