Game Development Community

Alt tab fix causes window borders to show in fullscreen

by Anton Bursch · in Torque Game Engine · 04/04/2006 (8:29 pm) · 3 replies

This alt tab fix www.garagegames.com/mg/forums/result.thread.php?qt=38805 causes window borders to show in fullscreen for me? Any ideas how to fix this, anyone?

www.alanandsandycarey.com/antonbursch/T2DAltTabTrouble.jpg

About the author

I design and direct games for Somatic Vision. We primarily make games for use with biofeedback, but our latest game, Tropical Heat, a jet ski racing game, is for regular gamers and is available on PC/Mac and will be available on ipad and iphone soon.


#1
04/04/2006 (9:51 pm)
Here is the fix for the entire alt-tab bug. I fixed it myself tonight.

In winOGLVideo.cc starting on line 701:

// Destroy the window:
      if ( winState.appWindow )
      {
         Con::printf( "Destroying the window..." );
         DestroyWindow( winState.appWindow );
         winState.appWindow = NULL;
      }
   }
   else if ( smIsFullScreen != newFullScreen )
   {
      // Change the window style:
      Con::printf( "Changing the window style..." );
      S32 windowStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
      if ( newFullScreen )
         [b]//windowStyle |= ( WS_POPUP | WS_MAXIMIZE | WS_VISIBLE);
         windowStyle |= ( WS_MAXIMIZE | WS_VISIBLE);[/b]
      else
         windowStyle |= ( WS_OVERLAPPED | WS_CAPTION );

      if ( winState.appWindow && !SetWindowLong( winState.appWindow, GWL_STYLE, windowStyle ) )
         Con::errorf( "SetWindowLong failed to change the window style!" );
   }

See the bold code. The commented out is the original. Switch to the version below it without the "WS_POPUP" and it works like a charm. :)

[b]//windowStyle |= ( WS_POPUP | WS_MAXIMIZE | WS_VISIBLE);
         windowStyle |= ( WS_MAXIMIZE | WS_VISIBLE);[/b]

Don't comment out the following like it says in the thread I mentioned above.

[b]// Destroy the window:
      if ( winState.appWindow )
      {
         Con::printf( "Destroying the window..." );
         DestroyWindow( winState.appWindow );
         winState.appWindow = NULL;
      }[/b]
#2
04/15/2006 (8:38 am)
Hi, Anton

In my case only works with this code:

// Destroy the window:
      if ( winState.appWindow )
     {
         Con::printf( "Destroying the window..." );
      [b]  // DestroyWindow( winState.appWindow ); <---- Commented [/b]
         winState.appWindow = NULL;
      }
...

Keeping your change as above:

//windowStyle |= ( WS_POPUP | WS_MAXIMIZE | WS_VISIBLE);  
        windowStyle |= ( WS_MAXIMIZE | WS_VISIBLE);

Thanks
#3
04/15/2006 (9:09 am)
I don't know about TGB, but in my TGE 1.4 copy here, I see no border with the other fix.
Thanks for the new fix, though.