8000 Going from/to maximized/fullscreen is buggy · Issue #1094 · dotnet/Silk.NET · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Going from/to maximized/fullscreen is buggy #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #1251
aybe opened this issue Sep 25, 2022 · 0 comments
Closed
Tracked by #1251

Going from/to maximized/fullscreen is buggy #1094

aybe opened this issue Sep 25, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@aybe
Copy link
aybe commented Sep 25, 2022

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();
    }
}
@aybe aybe added the bug Something isn't working label Sep 25, 2022
@Perksey Perksey self-assigned this Jan 22, 2023
@Perksey Perksey mentioned this issue Jan 22, 2023
14 tasks
Perksey added a commit that referenced this issue Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
0