private static Hwnd.Borders FrameExtents (IntPtr window)
{
IntPtr actual_atom;
int actual_format;
IntPtr nitems;
IntPtr bytes_after;
IntPtr prop = IntPtr.Zero;
Hwnd.Borders rect = new Hwnd.Borders ();
XGetWindowProperty (DisplayHandle, window, _NET_FRAME_EXTENTS, IntPtr.Zero, new IntPtr (16), false, (IntPtr)Atom.XA_CARDINAL, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
if (prop != IntPtr.Zero) {
if (nitems.ToInt32 () == 4) {
rect.left = Marshal.ReadInt32 (prop, 0);
rect.right = Marshal.ReadInt32 (prop, IntPtr.Size);
rect.top = Marshal.ReadInt32 (prop, 2 * IntPtr.Size);
rect.bottom = Marshal.ReadInt32 (prop, 3 * IntPtr.Size);
}
XFree (prop);
}
return rect;
}