-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
refactor: use views NonClientHitTest for draggable regions on mac #35603
Conversation
This supersedes #35007, I think. |
/cc @daniel-koc |
Overall looks great.
In such way we could remove overrides for AddBrowserView, RemoveBrowserView, SetTopBrowserView, ResetBrowserViews from BrowserWindow
The following definitions:
we could just move from native_window_mac.h and native_window_views.h into native_window.h |
d0b8ea0
to
53122fd
Compare
@samuelmaddock I've dropped one of the tests you added for the focus event here because it doesn't seem to work correctly when using |
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 really good. I have a couple of questions & minor suggestions but both the idea and impl look solid.
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
|
||
it('is triggered when BrowserWindow is focused', async () => { | ||
const window1 = new BrowserWindow({ show: false }); | ||
const window2 = new BrowserWindow({ show: false }); | ||
|
||
await Promise.all([ | ||
window1.loadURL('about:blank'), | ||
window2.loadURL('about:blank') | ||
]); | ||
|
||
const focusPromise1 = emittedOnce(window1.webContents, 'focus'); | ||
const focusPromise2 = emittedOnce(window2.webContents, 'focus'); | ||
|
||
window1.showInactive(); | ||
window2.showInactive(); | ||
|
||
window1.focus(); | ||
await expect(focusPromise1).to.eventually.be.fulfilled(); | ||
|
||
window2.focus(); | ||
await expect(focusPromise2).to.eventually.be.fulfilled(); | ||
}); |
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.
heads up @samuelmaddock, this removes a test that you added because it no longer passes. I'm pretty sure this is due to a Chrome bug that doesn't properly emit the web contents focused event when the window is focused on Mac/Views—the event is emitted if I click on the WebContents, just not when the window is only focused. Nothing else seems to be problematic in terms of using the WebContents though.
No Release Notes |
…ectron#35603) * refactor: use views NonClientHitTest for draggable regions on mac * iwyu * add backport of 9bb5f0316 * chore: update patches * remove some unneeded functions * remove test for triggering when BW is focused * chore: update patches * simplify views/mac split now that the draggable logic is the same * Apply suggestions from code review Co-authored-by: Charles Kerr <charles@charleskerr.com> * Update shell/browser/native_window.h Co-authored-by: Charles Kerr <charles@charleskerr.com> * fix build Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
Description of Change
This changes the implementation of draggable regions on macOS to use the
built-in Views tools for it.
See here for some more context.
Checklist
npm test
passesRelease Notes
Notes: none