return window_->SetIgnoreMouseEvents(ignore);
}
-void Window::SetIgnoreFocus(bool ignore) {
- return window_->SetIgnoreFocus(ignore);
+void Window::SetFocusable(bool focusable) {
+ return window_->SetFocusable(focusable);
}
void Window::CapturePage(mate::Arguments* args) {
.SetMethod("setDocumentEdited", &Window::SetDocumentEdited)
.SetMethod("isDocumentEdited", &Window::IsDocumentEdited)
.SetMethod("setIgnoreMouseEvents", &Window::SetIgnoreMouseEvents)
- .SetMethod("setIgnoreFocus", &Window::SetIgnoreFocus)
+ .SetMethod("setFocusable", &Window::SetFocusable)
.SetMethod("focusOnWebView", &Window::FocusOnWebView)
.SetMethod("blurWebView", &Window::BlurWebView)
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
void SetDocumentEdited(bool edited);
bool IsDocumentEdited();
void SetIgnoreMouseEvents(bool ignore);
- void SetIgnoreFocus(bool ignore);
+ void SetFocusable(bool focusable);
void CapturePage(mate::Arguments* args);
void SetProgressBar(double progress);
void SetOverlayIcon(const gfx::Image& overlay,
return false;
}
+void NativeWindow::SetFocusable(bool focusable) {
+}
+
void NativeWindow::SetMenu(ui::MenuModel* menu) {
}
virtual void SetDocumentEdited(bool edited);
virtual bool IsDocumentEdited();
virtual void SetIgnoreMouseEvents(bool ignore) = 0;
- virtual void SetIgnoreFocus(bool ignore) = 0;
+ virtual void SetFocusable(bool focusable);
virtual void SetMenu(ui::MenuModel* menu);
virtual bool HasModalDialog();
virtual gfx::NativeWindow GetNativeWindow() = 0;
void SetDocumentEdited(bool edited) override;
bool IsDocumentEdited() override;
void SetIgnoreMouseEvents(bool ignore) override;
- void SetIgnoreFocus(bool ignore) override;
bool HasModalDialog() override;
gfx::NativeWindow GetNativeWindow() override;
gfx::AcceleratedWidget GetAcceleratedWidget() override;
NSWindowCollectionBehaviorIgnoresCycle)];
}
+ bool focusable;
+ if (options.Get(options::kFocusable, &focusable) && !focusable)
+ [window_ setDisableKeyOrMainWindow:YES];
+
// Remove non-transparent corners, see http://git.io/vfonD.
if (!has_frame())
[window_ setOpaque:NO];
[window_ setIgnoresMouseEvents:ignore];
}
-void NativeWindowMac::SetIgnoreFocus(bool ignore) {
- [window_ setDisableKeyOrMainWindow:ignore];
-}
-
bool NativeWindowMac::HasModalDialog() {
return [window_ attachedSheet] != nil;
}
#endif
}
-void NativeWindowViews::SetIgnoreFocus(bool ignore) {
+void NativeWindowViews::SetFocusable(bool focusable) {
#if defined(OS_WIN)
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
- if (ignore)
+ if (focusable)
ex_style |= WS_EX_NOACTIVATE;
else
ex_style &= ~WS_EX_NOACTIVATE;
void SetHasShadow(bool has_shadow) override;
bool HasShadow() override;
void SetIgnoreMouseEvents(bool ignore) override;
- void SetIgnoreFocus(bool ignore) override;
+ void SetFocusable(bool focusable) override;
void SetMenu(ui::MenuModel* menu_model) override;
gfx::NativeWindow GetNativeWindow() override;
void SetOverlayIcon(const gfx::Image& overlay,
// Whether the window should have a shadow.
const char kHasShadow[] = "hasShadow";
+// Whether the window can be activated.
+const char kFocusable[] = "focusable";
+
// The WebPreferences.
const char kWebPreferences[] = "webPreferences";
extern const char kStandardWindow[];
extern const char kBackgroundColor[];
extern const char kHasShadow[];
+extern const char kFocusable[];
extern const char kWebPreferences[];
// WebPreferences.
implemented on Linux. Default is `true`.
* `closable` Boolean - Whether window is closable. This is not implemented
on Linux. Default is `true`.
+ * `focusable` Boolean - Whether the window can be focused. Default is
+ `true`.
* `alwaysOnTop` Boolean - Whether the window should always stay on top of
other windows. Default is `false`.
* `fullscreen` Boolean - Whether the window should show in fullscreen. When
this window, but if this window has focus, it will still receive keyboard
events.
-### `win.setIgnoreFocus(ignore)` _OS X_ _Windows_
-
-* `ignore` Boolean
-
-Prevents the window from getting focus.
+### `win.setActivatable(activatable)` _Windows_
-On OS X this API has to be called before the window shows:
+* `activatable` Boolean
-```javascript
-let win = new BrowserWindow({show: false})
-win.setIgnoreFocus(true)
-```
+Changes whether the window can be activated.
[blink-feature-string]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in