(034bb920b) Fixed selecting display resolution when using borderless on Linux

This commit is contained in:
Joonas Rikkonen
2019-06-04 16:01:49 +03:00
parent 6ffe13b4b7
commit c39eec8c89
2 changed files with 16 additions and 11 deletions
@@ -226,11 +226,6 @@ namespace Barotrauma
GraphicsWidth = Config.GraphicsWidth; GraphicsWidth = Config.GraphicsWidth;
GraphicsHeight = Config.GraphicsHeight; GraphicsHeight = Config.GraphicsHeight;
if (Config.WindowMode == WindowMode.BorderlessWindowed)
{
GraphicsWidth = GraphicsDevice.DisplayMode.Width;
GraphicsHeight = GraphicsDevice.DisplayMode.Height;
}
GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.Reach; GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.Reach;
GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color; GraphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;
@@ -272,6 +267,9 @@ namespace Barotrauma
{ {
base.Initialize(); base.Initialize();
DisplayWidth = GraphicsDevice.DisplayMode.Width;
DisplayHeight = GraphicsDevice.DisplayMode.Height;
RequestGraphicsSettings(); RequestGraphicsSettings();
ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true }; ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
@@ -333,6 +331,7 @@ namespace Barotrauma
ApplyGraphicsSettings(); ApplyGraphicsSettings();
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
} }
#endif
private void HandleDefocus(object sender, EventArgs e) private void HandleDefocus(object sender, EventArgs e)
{ {
@@ -349,9 +348,6 @@ namespace Barotrauma
} }
#endif #endif
loadingCoroutine = CoroutineManager.StartCoroutine(Load(canLoadInSeparateThread), "", canLoadInSeparateThread);
}
private void InitUserStats() private void InitUserStats()
{ {
if (GameSettings.ShowUserStatisticsPrompt) if (GameSettings.ShowUserStatisticsPrompt)
@@ -199,7 +199,7 @@ namespace Barotrauma
// In a bundled .app you just disable HiDPI in the info.plist // In a bundled .app you just disable HiDPI in the info.plist
// but that's probably not gonna happen. // but that's probably not gonna happen.
if (mode.Width > GameMain.Instance.GraphicsDevice.DisplayMode.Width || mode.Height > GameMain.Instance.GraphicsDevice.DisplayMode.Height) { continue; } if (mode.Width > GameMain.DisplayWidth || mode.Height > GameMain.DisplayHeight) { continue; }
#endif #endif
supportedDisplayModes.Add(mode); supportedDisplayModes.Add(mode);
} }
@@ -257,6 +257,15 @@ namespace Barotrauma
{ {
displayModeDD.SelectItem(GameMain.Config.WindowMode); displayModeDD.SelectItem(GameMain.Config.WindowMode);
} }
#endif
displayModeDD.OnSelected = (guiComponent, obj) =>
{
displayModeDD.SelectItem(WindowMode.Fullscreen);
}
else
{
displayModeDD.SelectItem(GameMain.Config.WindowMode);
}
#endif #endif
displayModeDD.OnSelected = (guiComponent, obj) => displayModeDD.OnSelected = (guiComponent, obj) =>
{ {
@@ -266,8 +275,8 @@ namespace Barotrauma
if (GameMain.Config.WindowMode == WindowMode.BorderlessWindowed) if (GameMain.Config.WindowMode == WindowMode.BorderlessWindowed)
{ {
resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.First( resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.First(
m => m.Width == GameMain.Instance.GraphicsDevice.DisplayMode.Width && m => m.Width == GameMain.DisplayWidth &&
m.Height == GameMain.Instance.GraphicsDevice.DisplayMode.Height)); m.Height == GameMain.DisplayHeight));
resolutionDD.ButtonEnabled = false; resolutionDD.ButtonEnabled = false;
} }
else else