Nw.js: Window 'resize' event fires when the window is dragged on hidpi displays

Created on 4 Feb 2017  路  3Comments  路  Source: nwjs/nw.js

Version: 0.20.0-sdk
OS: Windows 10

On a hidpi (devicePixelRatio > 1) display, every time a window is dragged across the screen to move it, the resize event fires, even though there has been no actual resizing done. Logging the w,h values on the event reveals that there are minor 1 pixel discrepancies every time the window is dragged, likely due to how the hidpi dimensions are calculated. In other words, every time the window is dragged the width/height appears to change randomly by +/-1 pixel causing the resize event to fire.

Running the app with the --force-device-scale-factor=1 does not exhibit this problem.

P3 bug triaged

Most helpful comment

I can reproduce this issue, but there are some difference.

  1. The window width and height don't change if I always drag the window with the initial size. But if I drag the window and toggle the maximize window, and then back, the width and height may change by +/-1.
  2. It doesn't happen every time in my environment.
Environment:
Display: devicePixelRatio =1.25
NW: 0.20.2-sdk
OS: Windows 10

All 3 comments

I can reproduce this issue, but there are some difference.

  1. The window width and height don't change if I always drag the window with the initial size. But if I drag the window and toggle the maximize window, and then back, the width and height may change by +/-1.
  2. It doesn't happen every time in my environment.
Environment:
Display: devicePixelRatio =1.25
NW: 0.20.2-sdk
OS: Windows 10

+1. Related: #5675

We are experiencing the same issue when the Windows 7/10 display setting has a devicePixelRatio that is a non-Integer.

Setting the position through the Window api causes the height and width to change by several pixels depending on how far the window is moved. 3 to 4 pixel differences have been observed.

Our current work around is to keep track of what the height and width should be and set the height/width every the position is moved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daverave1212 picture daverave1212  路  3Comments

imyzf picture imyzf  路  4Comments

rumax picture rumax  路  4Comments

gengshenghong picture gengshenghong  路  3Comments

bambooCZ picture bambooCZ  路  3Comments