On Windows focusable: false also means skipTaskbar: true

This commit is contained in:
Cheng Zhao 2016-06-13 17:24:45 +09:00
parent 8eca728e0a
commit 50f1837097
3 changed files with 14 additions and 7 deletions

View file

@ -181,6 +181,10 @@ NativeWindowViews::NativeWindowViews(
if (transparent() && !has_frame())
params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE;
bool focusable;
if (options.Get(options::kFocusable, &focusable) && !focusable)
params.activatable = views::Widget::InitParams::ACTIVATABLE_NO;
#if defined(OS_WIN)
params.native_widget =
new views::DesktopNativeWidgetAura(window_.get());
@ -696,10 +700,12 @@ void NativeWindowViews::SetFocusable(bool focusable) {
#if defined(OS_WIN)
LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
if (focusable)
ex_style |= WS_EX_NOACTIVATE;
else
ex_style &= ~WS_EX_NOACTIVATE;
else
ex_style |= WS_EX_NOACTIVATE;
::SetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE, ex_style);
SetSkipTaskbar(!focusable);
Focus(false);
#endif
}