// Returns true if processing should continue (base.SendEvent should be called), false if not
        protected virtual bool PreprocessMouseDown(NSEvent e)
        {
            bool   hitTestCalled = false;
            NSView hitTestView   = null;

            if (ToolStripManager.activeToolStrips.Count != 0)
            {
                hitTestCalled = true;
                hitTestView   = (ContentView.Superview ?? ContentView).HitTest(e.LocationInWindow);
                if (hitTestView != null && !ToolStripManager.IsChildOfActiveToolStrip(hitTestView.Handle))
                {
                    ToolStripManager.FireAppClicked();
                }
            }

            if (!hitTestCalled)
            {
                hitTestView = (ContentView.Superview ?? ContentView).HitTest(e.LocationInWindow);
            }
            var hitTestHandle        = hitTestView?.Handle ?? IntPtr.Zero;
            var hitTestControl       = Control.FromChildHandle(hitTestHandle);
            var hitTestControlHandle = hitTestControl?.Handle ?? IntPtr.Zero;

            if (e.Type == NSEventType.LeftMouseDown)
            {
                var topLevelParent = IntPtr.Zero;                       // FIXME
                mouseActivate = (MouseActivate)driver.SendMessage(ContentView.Handle, Msg.WM_MOUSEACTIVATE, topLevelParent, hitTestControlHandle).ToInt32();
                if (mouseActivate == MouseActivate.MA_NOACTIVATEANDEAT) // || mouseActivate == MouseActivate.MA_ACTIVATEANDEAT)
                {
                    return(true);
                }
            }

            if (hitTestControlHandle == IntPtr.Zero)
            {
                OnNcMouseDown(e);
            }
            else
            {
                if (!hitTestView.IsSwfControl())
                {
                    var p = driver.NativeToMonoScreen(this.ConvertPointToScreenSafe(e.LocationInWindow));
                    driver.SendParentNotify(hitTestControlHandle, Msg.WM_LBUTTONDOWN, p.X, p.Y);
                }
            }

            return(false);
        }
 public static Control ToControl(this NSView view)
 {
     return(view.IsSwfControl() ? Control.FromHandle(view.Handle) : Control.FromChildHandle(view.Handle));
 }