@@ -714,88 +714,25 @@ private void WebBrowserMode_FormClosing(object sender, FormClosingEventArgs e) {
714714 OnWebBrowserModeExit ( EventArgs . Empty ) ;
715715 }
716716
717+ // there used to be some lengthy (buggy) code here for some custom fullscreen behaviour
718+ // I was spending too much time trying to fix it for a non-essential feature of the program
719+ // so I've gotten rid of it for the default behaviour instead
717720 private void WebBrowserMode_Activated ( object sender , EventArgs e ) {
718721 CanShowToolbar = true ;
719722
720723 if ( messageFilter != null ) {
721724 Application . AddMessageFilter ( messageFilter ) ;
722725 }
723-
724- if ( ! IsHandleCreated || Handle == IntPtr . Zero ) {
725- return ;
726- }
727-
728- if ( ! Fullscreen ) {
729- return ;
730- }
731-
732- SW showCmd = WindowPlacement . showCmd ;
733-
734- if ( showCmd == SW . SW_SHOWMINIMIZED
735- || showCmd == SW . SW_MINIMIZE
736- || showCmd == SW . SW_SHOWMINNOACTIVE ) {
737- BringToFront ( ) ;
738- }
739726 }
740727
741728 private void WebBrowserMode_Deactivate ( object sender , EventArgs e ) {
742729 if ( messageFilter != null ) {
743730 Application . RemoveMessageFilter ( messageFilter ) ;
744731 }
745732
746- if ( ! IsHandleCreated || Handle == IntPtr . Zero ) {
747- return ;
748- }
749-
750- if ( ! Fullscreen ) {
751- return ;
752- }
753-
754- IntPtr foregroundWindow = GetForegroundWindow ( ) ;
755-
756- // we are the active window, because we are only now deactivating
757- // if this process has the foreground window, it'll be the active window
758- if ( Handle == foregroundWindow ) {
759- // this process opened a new window
760- if ( ! CanFocus ) {
761- // if there is a window above us in the z-order
762- IntPtr previousWindow = GetWindow ( Handle , GW . GW_HWNDPREV ) ;
763-
764- if ( previousWindow != IntPtr . Zero ) {
765- // if we own the window above us in the z-order
766- if ( Handle == GetWindow ( previousWindow , GW . GW_OWNER ) ) {
767- // the new window is a dialog that prevents focus to this window
768- CanShowToolbar = false ;
769- return ;
770- }
771- }
772- }
773-
774- // the new window is not a dialog that prevents focus to this window
775- Fullscreen = false ;
776- return ;
777- }
778-
779- // another process opened a window
780- if ( foregroundWindow != IntPtr . Zero ) {
781- // if we own the foreground window
782- if ( Handle == GetWindow ( foregroundWindow , GW . GW_OWNER ) ) {
783- // the new window is owned by this window
784- if ( CanFocus ) {
785- // the new window is not a dialog that prevents focus to this window
786- Fullscreen = false ;
787- } else {
788- // the new window is a dialog that does not prevent focus to this window
789- CanShowToolbar = false ;
790- }
791- return ;
792- }
733+ if ( ! CanFocus ) {
734+ CanShowToolbar = false ;
793735 }
794-
795- // we use SW_SHOWMINNOACTIVE so new windows (e.g. Task Manager) don't lose focus
796- WINDOWPLACEMENT windowPlacement = WindowPlacement ;
797- windowPlacement . showCmd = SW . SW_SHOWMINNOACTIVE ;
798- WindowPlacement = windowPlacement ;
799736 }
800737
801738 private void closableWebBrowser_Navigated ( object sender , WebBrowserNavigatedEventArgs e ) {
0 commit comments