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

NW2: User Window Metrics Not Saved/Respected #7322

Closed
rdtsc opened this issue Jan 17, 2020 · 7 comments
Closed

NW2: User Window Metrics Not Saved/Respected #7322

rdtsc opened this issue Jan 17, 2020 · 7 comments
Assignees
Labels

Comments

@rdtsc
Copy link

rdtsc commented Jan 17, 2020

Environment

  • NW.js Versions: 0.43.6 and 0.44.0 - reproducible on tag/nightly SDK/non-SDK builds.
  • Nightlies Tested: 20200117-051334 and 20200117-162000, respectively.
  • Tested Operating Systems: Linux (x64) and Windows 10 (x64).
  • Related Issues: Remove nw1 mode #7230

Expected Behavior

NW2-mode windows should remember their last position and size upon launch.

Actual Behavior

NW2-mode windows (with window.id) don't remember their last position and size upon relaunching NW. Windows are spawned at (0, 0) on the primary display with the initial size as specified in the package manifest.

A non-null window.position in the manifest is honored, though, it obviously has no effect on the initial size.

Reproduction

Manifest Bundle

nw1-nw2-manifests.zip

Demo (click for full size)

issue-capture

NW1 Manifest

{
  "name": "nwjs-window-position-history-nw1",
  "version": "1.0.0",
  "main": "data:,NW1 - OK",
  "chromium-args": "--disable-features=nw2",
  "window":
  {
    "id": "main",
    "width": 640,
    "height": 480
  }
}

NW2 Manifest

{
  "name": "nwjs-window-position-history-nw2",
  "version": "1.0.0",
  "main": "data:,NW2 - Fail",
  "chromium-args": "",
  "window":
  {
    "id": "main",
    "width": 640,
    "height": 480
  }
}
@rogerwang
Copy link
Member

Thanks for reporting. There was a fix for #7314 but it didn't cover this case.

@rogerwang rogerwang self-assigned this Jan 18, 2020
@rogerwang rogerwang added the nw2 label Jan 18, 2020
@rdtsc
Copy link
Author

rdtsc commented Jan 18, 2020

Thanks for reporting. There was a fix for #7314 but it didn't cover this case.

My apologies for missing such a fresh issue. I just eyeballed #7230 and didn't immediately see anything similar prior to filing this ticket.

Many thanks for your continued support of this project.

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rdtsc
Copy link
Author

rdtsc commented Jan 18, 2020

Thanks for the quick patch.

FYI, I tested this against v0.44.0's 20200118-162000/efb396e87 build and yesterday's fix seems to have resolved the window position issue only when the last state of the window is not maximized.

If the window is closed while it's maximized, it's restored in an incorrect position and with an incorrect size. Moreover, the original window size (pre-maximized) does not seem to be respected upon window restore.

In NW1 mode, everything works as expected. If a window is closed while it's maximized, it's restored to the maximized state upon launch and the window's title bar restore control restores the window to the previous geometry as well. This is not the case in NW2 mode.

Failing Behavior - NW2 (click for full size)

capture

Expected Behavior - NW1 (click for full size)

capture2

Manifests

Pretty much the same as the ones in the original issue.

NW2 - Failing Behavior

{
  "name": "nwjs-window-position-history-nw2-7322-test",
  "version": "1.0.0",
  "main": "about:blank",
  "window":
  {
    "id": "main",
    "width": 640,
    "height": 480
  }
}

NW1 - Expected Behavior

{
  "name": "nwjs-window-position-history-nw1-7322-test",
  "version": "1.0.0",
  "main": "about:blank",
  "chromium-args": "--disable-features=nw2",
  "window":
  {
    "id": "main",
    "width": 640,
    "height": 480
  }
}

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

The nightly build for this issue is available at https://dl.nwjs.io/live-build/nw44/20200119-184735/a8c4ae39c

@rdtsc
Copy link
Author

rdtsc commented Jan 20, 2020

No longer able to reproduce this issue on the latest linux/win x64 nightlies. Thanks again for the quick fix!

rogerwang added a commit to nwjs/chromium.src that referenced this issue Feb 27, 2020
saved > API parameter > default in manifest > default value

Fix nwjs/nw.js#7370
CC nwjs/nw.js#7322
CC nwjs/nw.js#7314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants