microsoft / microsoft/WindowsAppSDK

Suggestion: Add Minimize method to FullScreenPresenter

Open
#6,355 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Windowing feature proposal needs-triage
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.