internal static Size TranslateXWindowSizeToWindowSize (CreateParams cp, int xWidth, int xHeight)
{
/*
* If this is a form with no window manager, X is handling all the border and caption painting
* so remove that from the area (since the area we set of the window here is the part of the window
* we're painting in only)
*/
Size rect = new Size (xWidth, xHeight);
Form form = cp.control as Form;
if (form != null && (form.window_manager == null && !cp.IsSet (WindowExStyles.WS_EX_TOOLWINDOW))) {
Hwnd.Borders borders = Hwnd.GetBorders (cp, null);
Size xrect = rect;
xrect.Width += borders.left + borders.right;
xrect.Height += borders.top + borders.bottom;
rect = xrect;
}
return rect;
}