@@ -431,6 +431,8 @@ static public void DeactivateMode() {
431431 }
432432 }
433433
434+ private bool isActive = true ;
435+
434436 private void ShowToolbar ( ) {
435437 // this is checked in LowLevelMouseProc because
436438 // otherwise plugins such as Viscape which
@@ -442,22 +444,22 @@ private void ShowToolbar() {
442444 // of if our window is active
443445 Point toolBarToolStripMousePosition = toolBarToolStrip . PointToClient ( MousePosition ) ;
444446
445- if ( toolBarToolStrip . Visible ) {
446- if ( ! toolBarToolStrip . ClientRectangle . Contains ( toolBarToolStripMousePosition ) ) {
447- // the standard layout when the mouse is not in the toolbar rectangle
448- // if in fullscreen, ensure toolbar is invisible
449- // if not in fullscreen, ensure toolbar is visible
450- toolBarToolStrip . Visible = ! Fullscreen ;
451- }
452- } else {
453- if ( toolBarToolStripMousePosition . Y == 0
454- && toolBarToolStrip . ClientRectangle . Contains ( toolBarToolStripMousePosition ) ) {
455- // mouse in toolbar rectangle
456- // if in fullscreen, show toolbar if we can
457- // if not in fullscreen, ensure toolbar is visible
458- toolBarToolStrip . Visible = CanFocus || ! Fullscreen ;
459- }
447+ if ( toolBarToolStripMousePosition . Y != 0 && ! toolBarToolStrip . Visible && Fullscreen ) {
448+ return ;
449+ }
450+
451+ if ( toolBarToolStrip . ClientRectangle . Contains ( toolBarToolStripMousePosition ) ) {
452+ // mouse in toolbar rectangle
453+ // if in fullscreen, show toolbar if we can
454+ // if not in fullscreen, ensure toolbar is visible
455+ toolBarToolStrip . Visible = isActive || CanFocus || ! Fullscreen ;
456+ return ;
460457 }
458+
459+ // the standard layout when the mouse is not in the toolbar rectangle
460+ // if in fullscreen, ensure toolbar is invisible
461+ // if not in fullscreen, ensure toolbar is visible
462+ toolBarToolStrip . Visible = ! Fullscreen ;
461463 }
462464
463465 private bool addressToolStripSpringTextBoxEntered = false ;
@@ -700,19 +702,23 @@ private void WebBrowserMode_FormClosing(object sender, FormClosingEventArgs e) {
700702 // I was spending too much time trying to fix it for a non-essential feature of the program
701703 // so I've gotten rid of it for the default behaviour instead
702704 private void WebBrowserMode_Activated ( object sender , EventArgs e ) {
703- if ( messageFilter == null ) {
704- return ;
705- }
705+ isActive = true ;
706706
707- Application . AddMessageFilter ( messageFilter ) ;
707+ if ( messageFilter != null ) {
708+ Application . AddMessageFilter ( messageFilter ) ;
709+ }
710+
711+ ShowToolbar ( ) ;
708712 }
709713
710714 private void WebBrowserMode_Deactivate ( object sender , EventArgs e ) {
711- if ( messageFilter == null ) {
712- return ;
715+ isActive = false ;
716+
717+ if ( messageFilter != null ) {
718+ Application . RemoveMessageFilter ( messageFilter ) ;
713719 }
714720
715- Application . RemoveMessageFilter ( messageFilter ) ;
721+ ShowToolbar ( ) ;
716722 }
717723
718724 private void closableWebBrowser_Navigated ( object sender , WebBrowserNavigatedEventArgs e ) {
0 commit comments