electron: [Bug]: Wrong initial window size, when using multiple monitors with different resolution and scaling

Preflight Checklist

Electron Version

15.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10 Enterprise 20H2

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

The initial effectiv window size is correct in various screen and scaling combinations.

Actual Behavior

My setup: Two screens with different resolutions (external + laptop) side by side. The main monitor is the laptop screen. With 150% OS scaling. Secondary monitor is the external screen. With 100% OS scaling. The secondary (external) monitor is arranged on the left side of the primary monitor (laptop).

Open an new BrowserWindow on the secondary screen with new BrowserWindow({ show: true, width: 1500, height: 750, x: -1500, y: 150 }); results in a effective width of 987 and the effective height of 494. Thats wrong.

Open an new BrowserWindow on the primary screen with new BrowserWindow({ show: true, width: 1500, height: 750, x: -1500, y: 150 }); results in a effective width of 2233 and the effective height of 1118. Thats ok, because the main screen is scalled (150%).

Using 100% OS scaling on both screens both new BrowserWindows calls will have width of 1468 and height of 743. Thats also ok.

Testcase Gist URL

No response

Additional Information

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

See #10862 which may explain the root cause of this issue. I just added information with my investigation into this type of issue,

I can confirm that this is still an issue with Electron 25.