xenko icon indicating copy to clipboard operation
xenko copied to clipboard

Changing to/from full screen mode breaks mouse input and makes window invisible.

Open dfkeenan opened this issue 8 years ago • 2 comments

I am trying to implement how you change resolution and toggle between windowed and full screen. This is what I am currently doing is calling the below method from a scripts update method:

public void ChangeGraphics(int width, int height, bool fullScreen)
{
    if (Services.GetService<IGraphicsDeviceManager>() is GraphicsDeviceManager gdm)
    {
        
        Game.Window.BeginScreenDeviceChange(fullScreen);
        gdm.PreferredBackBufferWidth = width;
        gdm.PreferredBackBufferHeight = height;
        gdm.IsFullScreen = fullScreen;
        gdm.ApplyChanges();                
        Game.Window.EndScreenDeviceChange();
        //I think there is a bug here.  If you don't set the window visibility to true
        //In full screen mode mouse input does not work. i.e. Input.MousePosition does not update.
        //If you click the mouse you go back to the desktop and the game is still running but
        //does not appear in task manager or on the task bar etc. And if you are switching back to windowed mode
        //then the window is not visible. Does not even apear in task manager.
        //So always setting window to visible.
        Game.Window.Visible = true;               
        
    }
}

As the comment says if you do not set the Game.Window.Visible to true then:

  • Mouse input does not work (in full screen mode).
  • Clicking mouse while in full screen causes game window to loose focus.
  • Game does not appear on the task bar or in task manager.
  • If you switched back to windowed without setting window to visible then you wouldn't even know the game is running. The only way I could tell was because Visual Studio was still attached to the process.

Running on:

  • Windows 10 Pro v1709 Build 16299.19
  • Xenko 2.1.0.3
  • Running in debug mode.

dfkeenan avatar Nov 11 '17 07:11 dfkeenan

there are many issues with changing resolution/window/fullscreen see my issue here #605

EmptyKeys avatar Nov 11 '17 09:11 EmptyKeys

I swear I searched for "fullscreen", "full screen" and "window" and didn't find anything. My search-fu failing me I guess.

dfkeenan avatar Nov 11 '17 09:11 dfkeenan