Azaret / superputty

Automatically exported from code.google.com/p/superputty
MIT License
0 stars 0 forks source link

Suppress beep when closing terminal session #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Everytime a terminal session is closed the client (PuTTY or KiTTY) asks whether 
the session shall really be closed. The message box does not appear but a beep 
can be heard which I find quite annoying especially when many terminal sessions 
are open when SuperPuTTY is closed completely. I do not want to change it in my 
PuTTY configurations because I want to be asked when I close a standalone PuTTY 
session. Using WM_DESTROY instead of WM_CLOSE in 
ctlApplicationPanel.OnHandleDestroyed suppresses this beep. Also a sleep of 
100ms instead of 1000ms seems to be sufficient and makes closing a tab much 
smoother:

        /// <summary>
        /// Send a destroy message to the hosted application window when the parent is destroyed
        /// </summary>
        /// <param name="e"></param>
        protected override void OnHandleDestroyed(EventArgs e)
        {
            if (m_AppWin != IntPtr.Zero)
            {
                // Send WM_DESTROY instead of WM_CLOSE, so that the Client doesn't
                // ask in the Background whether the session shall be closed.
                // Otherwise an annoying beep is generated everytime a terminal session is closed.
                PostMessage(m_AppWin, WM_DESTROY, 0, 0);

                System.Threading.Thread.Sleep(100);

                m_AppWin = IntPtr.Zero;
            }

            base.OnHandleDestroyed(e);
        }

Original issue reported on code.google.com by breker.c...@gmail.com on 24 Apr 2012 at 12:15

GoogleCodeExporter commented 9 years ago
Cool.  Will put that into my next build.

The beeping/prompt can also be stopped via config on the session in putty, but 
this is easier.

Original comment by btatey...@gmail.com on 25 Apr 2012 at 1:01

GoogleCodeExporter commented 9 years ago

Original comment by btatey...@gmail.com on 25 Apr 2012 at 3:19