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

fix: window bounds not scaled from screen coordinates #29162

Merged
merged 1 commit into from May 19, 2021

Conversation

samuelmaddock
Copy link
Member

@samuelmaddock samuelmaddock commented May 14, 2021

Description of Change

fixed #25811

possibly related to #25420 #21777

On Windows, the will-resize and will-move events emit the pending bounds of the window. However, they're reported in screen coordinates which aren't scaled according to the display scale factor.

Here's a clip of a window being moved between a 4k and 1080p monitor which causes its scale factor to change. The width/height of newBounds remains the same with this fix.

(as an aside, there seems to be an unrelated rounding bug with the width/height of currentBounds you can also see)

2021-05-13_20-13-01.mp4

No tests are included as I'm not sure whether we have a way to test display scale changes.

Checklist

Release Notes

Notes: Fixed will-resize and will-move events not scaling the emitted newBounds rectangle to the appropriate Windows display scale factor.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label May 14, 2021
@samuelmaddock samuelmaddock added the semver/minor backwards-compatible functionality label May 14, 2021
@samuelmaddock samuelmaddock added semver/patch backwards-compatible bug fixes and removed semver/minor backwards-compatible functionality api-review/requested 🗳 labels May 14, 2021
Copy link

@pavelserbajlo pavelserbajlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes look good to me, amazing catch, Sam! 👏 👏

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label May 15, 2021
@zcbenz zcbenz merged commit d518b6a into electron:master May 19, 2021
@release-clerk
Copy link

release-clerk bot commented May 19, 2021

Release Notes Persisted

Fixed will-resize and will-move events not scaling the emitted newBounds rectangle to the appropriate Windows display scale factor.

@trop
Copy link
Contributor

trop bot commented May 19, 2021

I have automatically backported this PR to "11-x-y", please check out #29225

@trop
Copy link
Contributor

trop bot commented May 19, 2021

I have automatically backported this PR to "12-x-y", please check out #29226

@trop trop bot removed the target/12-x-y label May 19, 2021
@trop
Copy link
Contributor

trop bot commented May 19, 2021

I have automatically backported this PR to "13-x-y", please check out #29227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Will-move event listener newBounds parameter incorrect value
4 participants