feat: Implement BrowserWindow.setFocusable on macOS (#19033)
It was not implemented on Mac despite being available as a constructor option. Implementation already exists on Windows. Linux case can be separately. https://github.com/electron/electron/issues/19032 Notes: Implemented BrowserWindow.setFocusable on macOS.
This commit is contained in:
parent
e6a7a84834
commit
09c3277b42
3 changed files with 11 additions and 1 deletions
|
@ -104,6 +104,7 @@ class NativeWindowMac : public NativeWindow {
|
|||
bool IsDocumentEdited() override;
|
||||
void SetIgnoreMouseEvents(bool ignore, bool forward) override;
|
||||
void SetContentProtection(bool enable) override;
|
||||
void SetFocusable(bool focusable) override;
|
||||
void AddBrowserView(NativeBrowserView* browser_view) override;
|
||||
void RemoveBrowserView(NativeBrowserView* browser_view) override;
|
||||
void SetParentWindow(NativeWindow* parent) override;
|
||||
|
|
|
@ -1076,6 +1076,13 @@ void NativeWindowMac::SetContentProtection(bool enable) {
|
|||
setSharingType:enable ? NSWindowSharingNone : NSWindowSharingReadOnly];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetFocusable(bool focusable) {
|
||||
// No known way to unfocus the window if it had the focus. Here we do not
|
||||
// want to call Focus(false) because it moves the window to the back, i.e.
|
||||
// at the bottom in term of z-order.
|
||||
[window_ setDisableKeyOrMainWindow:!focusable];
|
||||
}
|
||||
|
||||
void NativeWindowMac::AddBrowserView(NativeBrowserView* view) {
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue