Skip to content
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

[Settings v2] Restore screen position and size #3685

Closed
enricogior opened this issue May 25, 2020 · 22 comments
Closed

[Settings v2] Restore screen position and size #3685

enricogior opened this issue May 25, 2020 · 22 comments
Assignees
Labels
Area-User Interface things that regard UX for PowerToys Idea-Enhancement New feature or request on an existing product Product-Settings The standalone PowerToys Settings application Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@enricogior
Copy link
Contributor

enricogior commented May 25, 2020

Settings v2 should follow the same logic used by the old Settings app.

  • by default open in the middle of the screen, not on the top left
  • on small screens it should auto resize to a proper height/width

Since it now has the about section, the default width should be large enough to show it on the right and not on the bottom (unless the screen is not large enough).

It should also retain size and position between runs (this is tracked by #3612)

@enricogior enricogior added Issue-Bug Something isn't working Product-Settings The standalone PowerToys Settings application Area-User Interface things that regard UX for PowerToys labels May 25, 2020
@crutkas crutkas added this to the v1.0 Release milestone May 25, 2020
@niels9001
Copy link
Contributor

Can't we just launch it full screen? Normal settings app does this.

@enricogior
Copy link
Contributor Author

Can't we just launch it full screen?

People with 4K and widescreen monitors would not be very happy (including myself) ;)

Normal settings app does this.

Which settings app are you referring to?

@mdtauk
Copy link

mdtauk commented May 25, 2020

UWP apps tend to open large by default - I always resize these windows down, and there is a "sweet spot" with Settings in particular, where the controls fit a 360px approx space, and the breakpoints for the sidebar content places the text to the right, rather than below.

image
image

@enricogior
Copy link
Contributor Author

I don't think we need a discussion for the default, once we support retaining the last size and position.

@mdtauk
Copy link

mdtauk commented May 25, 2020

I don't think we need a discussion for the default, once we support retaining the last size and position.

Initial Window Size is the first impression - but once the user resizes and moves the window, that should be what is respected.

@enricogior
Copy link
Contributor Author

Once it shows in middle of the screen with a reasonable size like this one, we should be good to go.

image

@niels9001
Copy link
Contributor

Can't we just launch it full screen?

People with 4K and widescreen monitors would not be very happy (including myself) ;)

Normal settings app does this.

Which settings app are you referring to?

Oh yes.. that makes sense :)! I was referring to the W10 Settings app. I wonder if Windows / UWP windowing have different behaviors when an app gets launched on a 4k 27" display vs. 15" laptop.

Launching it in the middle in a reasonable size sounds good 👍

@enricogior enricogior changed the title [Settings v2] default location and size [Settings v2] default screen position and size Jun 23, 2020
@enricogior enricogior changed the title [Settings v2] default screen position and size [Settings v2] default (and restore) screen position and size Dec 15, 2020
@crutkas
Copy link
Member

crutkas commented Dec 15, 2020

@davidegiacometti
Copy link
Collaborator

In the past I have made something similar and I had trouble with the main window maximized on a secondary monitor.
I have made a simple POC https://github.com/davidegiacometti/restore-window-poc using SetWindowPlacement and GetWindowPlacement that is properly handling that case.

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Jan 28, 2021

I'm still experiencing an issue on my Surface. It has a 200% scaling (because of the high resolution and relative small physical size) and the window doesn't open in the middle, the bottom is actually off-screen. I think I know where (in the code) the problem is. Should I mention that in this issue or open a new one?

@enricogior
Copy link
Contributor Author

@Jay-o-Way
we didn't do any fix for this, so this issue is still the issue to track this problem.

@Jay-o-Way
Copy link
Collaborator

In that case...

I was looking at settings/main.cpp and saw - starting at line 406 - the following:

HWND create_main_window(HINSTANCE hInstance)
{
    RECT desktopRect;
    const HWND hDesktop = GetDesktopWindow();
    WINRT_VERIFY(hDesktop != nullptr);
    WINRT_VERIFY(GetWindowRect(hDesktop, &desktopRect));

    int wind_width = 1024;
    int wind_height = 700;
    DPIAware::Convert(nullptr, wind_width, wind_height);

    return CreateWindowW(
        L"PTSettingsClass",
        L"PowerToys Settings",
        WS_OVERLAPPEDWINDOW,
        (desktopRect.right - wind_width) / 2,
        (desktopRect.bottom - wind_height) / 2,
        wind_width,
        wind_height,
        nullptr,
        nullptr,
        hInstance,
        nullptr);
}

I see that there is DPI "correction" for the window size, not for the display resolution.
image
numbers in brackets are what I call DPI-corrected numbers

I could make a screenshot of the window's first position on my Surface, if wanted?

@enricogior
Copy link
Contributor Author

@Jay-o-Way
that's OK, I can also reproduce it on my laptop. Thanks.

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Jan 28, 2021

Well, turned out I was off, quite a bit. It does show in the horizontal center, but not in the vertical middle. Is there another function moving/resizing the window after it is opened?
Anyways, this is the screenshot of the window at first sight, scale @ 200%:
PT window at start-up
Initial window size approx 2174 x 1590 pixels. Top-left corner is at 303x293 pixels.

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Jan 28, 2021

When I change scale to 100%, this is the initial position:
PT window at 100percent
Top-left corner at almost 150x150 pixels.

If I change the scale back to 200% while the window is open, is does get moved in the work-area of the desktop, so that (WM_DPICHANGED?) is working good.
Clicking the tray-icon to open the window messes it up, but weird enough not 100% of the time. The position (left/top) changes alot every time I open the window. I'm gonna guess it's somewhere in the open_settings_window() function. I don't know. It's really difficult to understand all those different files and functions. #NeedMoreComments

@kethan1
Copy link

kethan1 commented Feb 9, 2021

@enricogior any plan on fixing this soon? This issue's pretty annoying, anything stopping this from being fixed?

@enricogior
Copy link
Contributor Author

@kethan1
as you can see on the right column of this issue, it is planned for the 0.33 release

image

We have hundreds of known issue, it would be great to be able to fix all of them in a few days/weeks but we are a small team with limited bandwidth.

@enricogior
Copy link
Contributor Author

#10022 fixes the default location for the new Settings and also guarantees that the Settings (and OOBE) are always inside the screen work area.
The default location is center screen.
Changing the title to reflect that the remaining work for this issue is to save the position/size and use it when the Settings/OOBE is reopened.

@enricogior enricogior changed the title [Settings v2] default (and restore) screen position and size [Settings v2] Restore screen position and size Mar 4, 2021
@dedavis6797
Copy link
Contributor

@jaimecbernardo based on @enricogior 's last comment, is this something we can likely knock out in v0.45? Or should we allot more time?

@jaimecbernardo
Copy link
Collaborator

This feels more like a nice to have, plus if done in a rush it can lead to new issues (improperly detecting that the position/size saved are no longer valid, for example). I think we still have higher priorities here, so we should push this back.

@crutkas crutkas added Idea-Enhancement New feature or request on an existing product and removed Issue-Bug Something isn't working labels Oct 14, 2021
@davidegiacometti davidegiacometti self-assigned this Oct 19, 2021
@davidegiacometti davidegiacometti added the Status-In progress This issue or work-item is under development label Oct 19, 2021
@davidegiacometti davidegiacometti added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Oct 25, 2021
@dedavis6797
Copy link
Contributor

Resolved with v0.49.0. Thanks @davidegiacometti!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface things that regard UX for PowerToys Idea-Enhancement New feature or request on an existing product Product-Settings The standalone PowerToys Settings application Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

9 participants