Skip to content

fix: return correct bounds on will-resize - #19639

Merged
codebytere merged 1 commit into
masterfrom
intern/fix-will-resize
Aug 8, 2019
Merged

codebytere merged 1 commit into
masterfrom
intern/fix-will-resize

Conversation

@deermichel

Copy link
Copy Markdown
Contributor

Description of Change

Fixes #19611.

Use gfx::ScreenRectFromNSRect to refer to the window's top-left corner as origin instead of the bottom-left one.

No tests since will-resize cannot be triggered programmatically - correct me if i'm wrong :)

cc @codebytere @pmkary

Checklist

Release Notes

Notes: Fixed BrowserWindow's will-resize event returning wrong bounds on macOS.

@alitaheri

Copy link
Copy Markdown

Will this also take position change into account?

I'm not a expert at reading the electron code base. What I'm worried about is that when the user grabs one of the top, top-left, top-right, left, bottom-left corners and tries to resize from there. it's not only the size that changes. the position will change too.

For example:

If I have a window at (x=10, y=10, width=20, height=30) and drag the left edge and move my mouse 5 pixels the newBounds passed to the will-resize callback must be (x=5, y=10, width=25, height=30) this is to keep the right edge at it's place. and it's crucial for our application to actually receive the correct newBounds. otherwise it won't be able to figure out which edge is being dragged.

So, please check this and make sure this behavior is provided. it is on windows.

Thank you very much 👍

@deermichel

Copy link
Copy Markdown
Contributor Author

I think so:

jj

@alitaheri

Copy link
Copy Markdown

Perfect 😍 Thank you

@codebytere
codebytere self-requested a review August 6, 2019 17:11
@deermichel
deermichel force-pushed the intern/fix-will-resize branch from 3ca3ae9 to 45b8cb2 Compare August 6, 2019 20:14
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Aug 7, 2019
@codebytere
codebytere merged commit 9eb89b4 into master Aug 8, 2019
@release-clerk

release-clerk Bot commented Aug 8, 2019

Copy link
Copy Markdown

Release Notes Persisted

Fixed BrowserWindow's will-resize event returning wrong bounds on macOS.

@codebytere
codebytere deleted the intern/fix-will-resize branch August 8, 2019 02:59
@trop

trop Bot commented Aug 8, 2019

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "5-0-x" cleanly;
you will need to perform this backport manually.

@trop trop Bot removed the target/5-0-x label Aug 8, 2019
@trop

trop Bot commented Aug 8, 2019

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "6-0-x" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 8, 2019

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "7-0-x", please check out #19680

@pouyakary

Copy link
Copy Markdown

So nice, thanks a lot @deermichel 😍

@trop

trop Bot commented Aug 9, 2019

Copy link
Copy Markdown
Contributor

A maintainer has manually backported this PR to "6-0-x", please check out #19704

@trop

trop Bot commented Aug 9, 2019

Copy link
Copy Markdown
Contributor

A maintainer has manually backported this PR to "5-0-x", please check out #19705

@davej

davej commented Apr 27, 2020

Copy link
Copy Markdown
Contributor

I believe there is a bug here. The y value changes on newBounds when the window is dragged from the bottom edge. It can be seen in @deermichel's gif above. This behaviour is also inconsistent with Windows where the y value doesn't change (correctly IMO).

@nrajinikanth

Copy link
Copy Markdown

+1 to @davej comment. When resizing from the bottom edge, I see y origin in newBounds differs from y origin in current bounds. Is there any way to workaround this issue and/or a plan to fix? Looking for some way to detect that a user has dragged the browser window from the bottom edge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrowserWindow's "will-resize" event's callback is provided with bizarre newBounds value

8 participants