microsoft / microsoft/WindowsAppSDK
Suggestion: Add Minimize method to FullScreenPresenter
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
Currently there is no way to directly minimize a fullscreen window (without using Win32 APIs). One has to change to an OverlappedPresenter first, but then when the window is restored it is no longer fullscreen. It ought to be possible to minimize the window directly. I suggest the Minimize() and Minimize(bool activateWindow) methods should be copied from OverlappedPresenter to FullScreenPresenter (and probably to CompactOverlayPresenter as well although I haven't used that).
As an example of an app that implements this behavior, see the built-in Photos app.
The workaround code is not difficult (see below), but it would be good to avoid having to use Dll imports.
public static bool MinimizeWindow(Window window, bool activate = false) {
if (window == null) {
return false;
}
var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(window);
return ShowWindow(hwnd, activate ? SW_SHOWMINIMIZED : SW_SHOWMINNOACTIVE);
}
/* Win32 imports */
private const int SW_SHOWMINIMIZED = 2;
private const int SW_SHOWMINNOACTIVE = 7;
[LibraryImport("user32.dll")]
[return: MarshalAs(UnmanagedType.I4)]
private static partial bool ShowWindow(IntPtr hwnd, int nCmdShow);
/* */
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the FullScreenPresenter and OverlappedPresenter implementations and compare the existing Minimize() and Minimize(bool activateWindow) APIs. Check how presenter state is tested, then verify that minimizing and restoring a fullscreen window preserves fullscreen behavior and supports both activation options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, csharp
- Domain
- api, desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100