feat: allow setting window shape (backport: 3-0-x) (#14445)

* feat: allow setting window shape

This binds Widget::SetShape, an API that already exists in Chromium (for
Windows and Linux). It's a more reliable method of having some parts of
your window be "click-through" than the current `setIgnoreMouseEvents`
API, which messes around with the `WS_EX_LAYERED` window style on
Windows, causing strange bugs and incompatibility with hardware
acceleration.

* update docs
This commit is contained in:
trop[bot] 2018-09-04 09:22:11 -07:00 committed by Shelley Vohr
parent 12087b74e8
commit ce592a5705
4 changed files with 28 additions and 0 deletions

View file

@ -893,6 +893,17 @@ describe('BrowserWindow module', () => {
})
})
describe('BrowserWindow.setShape(rects)', () => {
it('allows setting shape', () => {
assert.doesNotThrow(() => {
w.setShape([])
w.setShape([{x: 0, y: 0, width: 100, height: 100}])
w.setShape([{x: 0, y: 0, width: 100, height: 100}, {x: 0, y: 200, width: 1000, height: 100}])
w.setShape([])
})
})
})
describe('"useContentSize" option', () => {
it('make window created with content size when used', () => {
w.destroy()