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: return correct bounds on will-resize #19639

Merged
merged 1 commit into from
Aug 8, 2019
Merged

Conversation

deermichel
Copy link
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.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Aug 5, 2019
@alitaheri
Copy link

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
Contributor Author

I think so:

jj

@alitaheri
Copy link

Perfect 😍 Thank you

@codebytere codebytere self-requested a review August 6, 2019 17:11
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Aug 7, 2019
@codebytere codebytere merged commit 9eb89b4 into master Aug 8, 2019
@release-clerk
Copy link

release-clerk bot commented Aug 8, 2019

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
Copy link
Contributor

trop bot commented Aug 8, 2019

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
Copy link
Contributor

trop bot commented Aug 8, 2019

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

@trop
Copy link
Contributor

trop bot commented Aug 8, 2019

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

@pouyakary
Copy link

So nice, thanks a lot @deermichel 😍

@trop
Copy link
Contributor

trop bot commented Aug 9, 2019

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

@trop
Copy link
Contributor

trop bot commented Aug 9, 2019

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

@sofianguy sofianguy added this to Fixed for 6.0.2 in 6.1.x Aug 14, 2019
@sofianguy sofianguy added this to 7.0.0-beta.3 in 7.2.x Aug 15, 2019
@sofianguy sofianguy added this to Fixed in 5.0.10 in 5.0.x Aug 20, 2019
@davej
Copy link
Contributor

davej commented Apr 27, 2020

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

+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
No open projects
5.0.x
Fixed in 5.0.10
6.1.x
Fixed for 6.0.2
7.2.x
Fixed in 7.0.0-beta.3
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