microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.37k stars 682 forks source link

Kicked out of fullscreen on AppSDK 1.6 #10152

Open tom-huntington opened 1 week ago

tom-huntington commented 1 week ago

Describe the bug

I upgraded to AppSDK 1.6 and my app would not go fullscreen (Boarderless).

Specifically this is a problem when the task bar is "minimized" (one or two pixels). There is no problem when the task bar is fixed. And you are using SetWindowLong, SetWindowPos and ShowWindow to enter fullscreen.

If you already are in fullscreen, then AudioGraph.CreateDeviceInputNodeAsync will cause the 2 pixels of the minimized task bar to be shown.

If first you call AudioGraph.CreateDeviceInputNodeAsync then after that you are unable to go fullscreen. The 2 pixels of the minimized task bar will still be there.

Steps to reproduce the bug

I have made a MRE with a fullscreen button, and a button that calls AudioGraph.CreateDeviceInputNodeAsync

https://github.com/tom-huntington/SetWindowLongMRE

NuGet package version

Windows App SDK 1.6.1: 1.6.240923002

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 21H2 (22000)

IDE

Visual Studio 2022

Additional context

Previously to upgrading to 1.6 the debugger did not break of exceptions in SetWindowLong. After upgrading it breaks on exceptions in SetWindowLong. (Its removing WS_CAPTION that causes the exceptions)

Note: This AudioGraph.CreateDeviceInputNodeAsync behaviour only happens when launching F5/ctrl+F5. When starting from start menu the fullscreen is messed up from the start)

tom-huntington commented 1 week ago

This is only a problem with the Win32 Fullscreen APIs. The AppSDK Fullscreen API works fine

AppWindow.SetPresenter(Microsoft::UI::Windowing::AppWindowPresenterKind::FullScreen);

I wonder what AppWindow.SetPresenter is doing differently?

The minimized task bar will go away with HWND_TOPMOST