Nw.js: NW2: User Window Metrics Not Saved/Respected

Created on 17 Jan 2020  路  7Comments  路  Source: nwjs/nw.js

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: #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
  }
}
nw2

Most helpful comment

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

All 7 comments

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

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.

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

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
  }
}

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

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

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

Was this page helpful?
0 / 5 - 0 ratings