public bool PreFilterMessage(ref Message m)
        {
            // If we have suspended operation....
            if (_suspended > 0)
            {
                // Intercept the non-client mouse move to prevent the custom
                // chrome of the form from providing hot tracking feedback
                if (m.Msg == PI.WM_NCMOUSEMOVE)
                {
                    return(true);
                }

                // A mouse move can occur because a context menu is showing with a popup also
                // already showing. We suppress the mouse move to prevent tracking of the popup
                if (m.Msg == PI.WM_MOUSEMOVE)
                {
                    return(ProcessMouseMoveWithCMS(ref m));
                }

                return(false);
            }

            if (_current != null)
            {
                // If the popup has been become disposed
                if (_current.IsDisposed)
                {
                    EndCurrentTracking();
                    return(false);
                }
                else
                {
                    // Get the active window
                    IntPtr activeWindow = PI.GetActiveWindow();

                    // Is there a change in active window?
                    if (activeWindow != _activeWindow)
                    {
                        // If the current window has become active, ask popup if that is allowed
                        if ((activeWindow == _current.Handle) && _current.AllowBecomeActiveWhenCurrent)
                        {
                            _activeWindow = _current.Handle;
                        }
                        else
                        {
                            bool focus = _current.ContainsFocus;

                            if (!focus)
                            {
                                VisualPopup[] popups = _stack.ToArray();

                                // For from last to first for any popup that has the focus
                                for (int i = popups.Length - 1; i >= 0; i--)
                                {
                                    if (!popups[i].IsDisposed)
                                    {
                                        if (popups[i].ContainsFocus)
                                        {
                                            focus = true;
                                            break;
                                        }
                                    }
                                }
                            }

                            // If the change in active window (focus) is not to the current
                            // or a stacked popup then we need to pull down the entire stack
                            // as focus has been shifted away from the use of any popup.
                            if (!focus)
                            {
                                EndAllTracking();
                                return(false);
                            }
                        }
                    }
                }

                // We only intercept and handle keyboard and mouse messages
                if (!IsKeyOrMouseMessage(ref m))
                {
                    return(false);
                }

                switch (m.Msg)
                {
                case PI.WM_KEYDOWN:
                case PI.WM_SYSKEYDOWN:
                    // If the popup is telling us to redirect keyboard to itself
                    if (!_current.KeyboardInert)
                    {
                        // If the focus is not inside the actual current tracking popup
                        // then we need to manually translate the message to ensure that
                        // KeyPress events occur for the current popup.
                        if (!_current.ContainsFocus)
                        {
                            PI.MSG msg = new PI.MSG
                            {
                                hwnd    = m.HWnd,
                                message = m.Msg,
                                lParam  = m.LParam,
                                wParam  = m.WParam
                            };
                            PI.TranslateMessage(ref msg);
                        }
                        return(ProcessKeyboard(ref m));
                    }
                    break;

                case PI.WM_CHAR:
                case PI.WM_KEYUP:
                case PI.WM_DEADCHAR:
                case PI.WM_SYSCHAR:
                case PI.WM_SYSKEYUP:
                case PI.WM_SYSDEADCHAR:
                    // If the popup is telling us to redirect keyboard to itself
                    if (!_current.KeyboardInert)
                    {
                        return(ProcessKeyboard(ref m));
                    }

                    break;

                case PI.WM_MOUSEMOVE:
                case PI.WM_NCMOUSEMOVE:
                    return(ProcessMouseMove(ref m));

                case PI.WM_LBUTTONDOWN:
                case PI.WM_RBUTTONDOWN:
                case PI.WM_MBUTTONDOWN:
                    return(ProcessClientMouseDown(ref m));

                case PI.WM_NCLBUTTONDOWN:
                case PI.WM_NCRBUTTONDOWN:
                case PI.WM_NCMBUTTONDOWN:
                    return(ProcessNonClientMouseDown(ref m));
                }
            }

            return(false);
        }