Closed
Description
Summary
Maximize the window, go full screen, try go back, it's stuck.
But if you quickly switch to normal before going full screen, it works; try change bug
to false
.
Also, the value of window state is wrong sometimes, it doesn't always follow the actual state of the window.
Steps to reproduce
For desktop, version 2.16.0
using System.Drawing;
using Silk.NET.Input;
using Silk.NET.OpenGL;
using Silk.NET.Windowing;
// ReSharper disable AccessToDisposedClosure
namespace Silk_Test;
internal static class Program
{
private static void Main(string[] args)
{
var bug = true; // try change this
using var window = Window.Create(WindowOptions.Default);
// ReSharper disable once RedundantAssignment
IInputContext input = null!;
GL gl = null!;
window.Load += () =>
{
gl = window.CreateOpenGL();
input = window.CreateInput();
input.Keyboards[0].KeyDown += OnKeyDown;
};
void OnKeyDown(IKeyboard keyboard, Key key, int code)
{
if (keyboard.IsKeyPressed(Key.AltLeft) && keyboard.IsKeyPressed(Key.Enter))
{
if (bug)
{
switch (window.WindowState)
{
case WindowState.Normal:
window.WindowState = WindowState.Fullscreen;
break;
case WindowState.Minimized:
break;
case WindowState.Maximized:
window.WindowState = WindowState.Fullscreen;
break;
case WindowState.Fullscreen:
window.WindowState = WindowState.Normal;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
else
{
switch (window.WindowState)
{
case WindowState.Normal:
window.WindowState = WindowState.Fullscreen;
break;
case WindowState.Minimized:
break;
case WindowState.Maximized:
window.WindowState = WindowState.Normal;
window.WindowState = WindowState.Fullscreen;
break;
case WindowState.Fullscreen:
window.WindowState = WindowState.Normal;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
if (keyboard.IsKeyPressed(Key.Escape))
window.Close();
}
window.Render += d =>
{
var color = window.WindowState switch
{
WindowState.Normal => Color.Red,
WindowState.Minimized => Color.Green,
WindowState.Maximized => Color.Blue,
WindowState.Fullscreen => Color.White,
_ => throw new ArgumentOutOfRangeException()
};
gl.ClearColor(color);
gl.Clear(ClearBufferMask.ColorBufferBit);
};
window.Run();
}
}