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: Initial window size is wrong #7224

Closed
Luzzifus opened this issue Nov 19, 2019 · 3 comments
Closed

nw2: Initial window size is wrong #7224

Luzzifus opened this issue Nov 19, 2019 · 3 comments
Labels

Comments

@Luzzifus
Copy link

Luzzifus commented Nov 19, 2019

NWJS Version : 0.42.5
Operating System : Win10 (1903)

Expected behavior

Calling nw.Window.open() with the window flags "width" and "height" should open a window with the given size.

Actual behavior

The actual size of the opened window is smaller. Adding a .resizeTo() in the callback of nw.Window.open() doesn't help. Calling .resizeTo() a bit later sets the correct size.

How to reproduce

Only happens in NW2 mode, works as expected with "chromium-args": "--disable-features=nw2".

This yields a window which is smaller than 250x100 (in my case 234x92):

let windowOptions = {
  show: true,
  title: 'test',
  width: 250,
  height: 100,
  position: 'center',
  frame: false,
  transparent: true,
  show_in_taskbar: false
};

nw.Window.open('html/widget.html', windowOptions);

This still results in the smaller window:

let cb = win => win.resizeTo(250, 100);
nw.Window.open('html/widget.html', windowOptions, cb);

This result in the correctly sized window:

let cb = win => setTimeout(() => win.resizeTo(250, 100), 100);
nw.Window.open('html/widget.html', windowOptions, cb);

#7230

@rogerwang rogerwang added the nw2 label Nov 22, 2019
@rogerwang
Copy link
Member

I recently clarified the setting of inner/outer dimension if the window:
9ea8972#diff-e3e2a9bfd88566b05001b02a3f51d286

So the behaviour would be different with NW1.

@rogerwang
Copy link
Member

This scenario is working as expected for me and it's covered in the tests: https://github.com/nwjs/nw.js/tree/nw43/test/sanity/window-resizeto

close for now.

@Luzzifus
Copy link
Author

@rogerwang I checked again with 0.43.2 and a minimal code example. The whole behaviour in this issue seems to be related to the transparent window option misbehaviour. It works for non-transparent windows, but if I try to make the window transparent, I get the non-transparent background window as described/shown in #7221 and the actual content element is too small.

So yes, it works for non-transparent windows.

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