public bool IsDocumentSelected(CtlPuttyPanel document)
        {
            bool selected = false;

            if (document?.Session != null)
            {
                selected = checkSendToVisible.Checked ? document.Visible : document.AcceptCommands;
            }
            return(selected);
        }
示例#2
0
        void UpdateForeground()
        {
            // if we got the EVENT_SYSTEM_FOREGROUND, and the hwnd is the putty terminal hwnd (m_AppWin)
            // then bring the supperputty window to the foreground
            Log.DebugFormat("[{0}] HandlingForegroundEvent: settingFG={1}", m_AppWin, settingForeground);
            if (settingForeground)
            {
                settingForeground = false;
                return;
            }


            // This is the easiest way I found to get the superputty window to be brought to the top
            // if you leave TopMost = true; then the window will always be on top.
            if (TopLevelControl != null)
            {
                Form form = SuperPuTTY.MainForm;
                if (form.WindowState == FormWindowState.Minimized)
                {
                    return;
                }

                DesktopWindow window = DesktopWindow.GetFirstDesktopWindow();
                m_windowActivator.ActivateForm(form, window, m_AppWin);

                // focus back to putty via setting active dock panel
                CtlPuttyPanel parent = (CtlPuttyPanel)Parent;
                if (parent?.DockPanel != null)
                {
                    if (parent.DockPanel.ActiveDocument != parent && parent.DockState == DockState.Document)
                    {
                        string activeDoc = parent.DockPanel.ActiveDocument != null
                            ? ((ToolWindow)parent.DockPanel.ActiveDocument).Text : "?";
                        Log.InfoFormat("[{0}] Setting Active Document: {1} -> {2}", m_AppWin, activeDoc, parent.Text);
                        parent.Show();
                    }
                    else
                    {
                        // give focus back
                        ReFocusPuTTY("WinEventProc-FG, AltTab=" + isSwitchingViaAltTab);
                    }
                }
            }
        }