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
feat: implement win.setAspectRatio() on Windows #18306
Conversation
Co-Authored-By: Charles Kerr <ckerr@github.com>
Co-Authored-By: Charles Kerr <ckerr@github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though I'd like to have a second reviewer's eyes on this before merging.
@ckerr thanks all your review and advice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like views already has logic for handling aspect ratios: https://chromium.googlesource.com/chromium/src/+/master/ui/views/win/hwnd_message_handler.cc#890
Is there any way we can reuse that code instead of rewriting the event handler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the party, but with @nornagon's comments, this looks good!
Also, would love to get a test for this behaviour. |
Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>
@nornagon Thanks your advice, and I will try to reuse chromium code. chromium code look so nice. but I should find wayt how to get this function or class reference from chromium module. I will fully reference this code. very thanks ~ |
…ishDT/electron into upstream/window-aspectratio
Hi I have tried to use widget()->setAspectRatio() from chromium api but it was not working properly. The size of the frame was not correct and it also disables the resizing of the window so it looks to me we should go with @MadfishDT 's solution. Here is what I tried:
|
@MadfishDT if you could please resolve conflicts that would be great |
This comment has been minimized.
This comment has been minimized.
Sorry, I had some ear infection problem. so I could not touch code until yesterday. I will fix it as soon as possible. thanks all comments |
no worries, thanks @MadfishDT! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ok to me following latest review round of updates, but i'd like @nornagon's final sign-off here given that the last feedback was his.
refs: #8036 |
@CapOM I tried it exploring that on this branch here: https://github.com/electron/electron/tree/intern/set-aspect-ratio and it worked for me on Ubuntu.
edit: opened #19516 as a tentative PR. |
I can fix Conflicted files. but I can't handling progress merge step. |
@nornagon would you be able to give this final review? |
@nornagon Could you please give the final review? I'm also waiting merge of this great change since I need this function for my product. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for your patience.
I'm still 👎 on merging this:
- There's still no tests for this functionality.
- I think something was wrong with the attempt to reuse Chrome's functionality, because:
- it works on Linux
- one of the stated symptoms was "can't resize the window", but looking at the code in https://chromium.googlesource.com/chromium/src/+/648cbca3096b452ad67187ff3b2ae8870f5426c5/ui/views/win/hwnd_message_handler.cc#2527, it seems to explicitly handle resizing the window.
- Chrome handles different display resolutions (
DIPToScreenSize
), which this code doesn't.
@nornagon |
I absolutely agree with you. |
@codebytere @nornagon @MadfishDT Is there any update? |
@MadfishDT Do you have any plans for @nornagon 's request ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has not changed since my last review.
Sorry I had some big project in my company and I changed my job(company). so I had no time for handling this issue and marchine for building electron. I am going to start fix code from next week. |
@MadfishDT Hi, Is there any update? :) |
I'm closing this PR in favor of #26941, which reuses Chromium's code for implementing this API. |
Description of Change
Description of Change
Implemented win.setAspectRatio() on Windows by handling the WM_SIZING message.
Checklist
npm test
passesRelease Notes
Notes: Implemented win.setAspectRatio() on Windows.