/// <summary>
        /// Performs some housekeeping then passes control to the user-supplied  handler.
        /// </summary>
        /// <param name="windowId"></param>
        void DoSubwindow(int windowId)
        {
            SubWindow window = GetSubwindowFromId(windowId);

            if (window.HandleUpdate != null)
            {
                window.HandleUpdate(windowId);
            }

            //for some insane reason we *have* to call this or all clicks
            //will leak onto controls behind this window. Fixed and Popup windows
            //will ignore the repositioning though.
            GUI.DragWindow();
        }