private void TranslatePosition(Gdk.Window current, double eventX, double eventY, out int x, out int y) { x = (int)eventX; y = (int)eventY; while (current != window.Window) { int cx, cy, cw, ch; current.GetGeometry (out cx, out cy, out cw, out ch); x += cx; y += cy; current = current.Parent; } }