diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc index c7aac43..89817b7 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc @@ -758,6 +758,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() { ::SetFocus(host->GetAcceleratedWidget()); } #endif +#if defined(OS_LINUX) + if (CanFocus()) { + aura::WindowTreeHost* host = window_->GetHost(); + if (host) + host->Show(); + } +#endif if (host_ && set_focus_on_mouse_down_) { set_focus_on_mouse_down_ = false; host_->Focus(); diff --git ui/views/widget/desktop_aura/x11_desktop_handler.cc ui/views/widget/desktop_aura/x11_desktop_handler.cc index 5ab84f9..1052e2c 100644 --- ui/views/widget/desktop_aura/x11_desktop_handler.cc +++ ui/views/widget/desktop_aura/x11_desktop_handler.cc @@ -31,6 +31,30 @@ views::X11DesktopHandler* g_handler = NULL; namespace views { +namespace { + +bool IsParentOfWindow(XDisplay* xdisplay, + ::Window potential_parent, + ::Window window) { + ::Window parent_win, root_win; + Window* child_windows; + unsigned int num_child_windows; + while (window) { + if (!XQueryTree(xdisplay, window, &root_win, &parent_win, + &child_windows, &num_child_windows)) { + break; + } + if(child_windows) + XFree(child_windows); + if (parent_win == potential_parent) + return true; + window = parent_win; + } + return false; +} + +} // namespace + // static X11DesktopHandler* X11DesktopHandler::get() { if (!g_handler) @@ -58,14 +82,7 @@ X11DesktopHandler::X11DesktopHandler() attr.your_event_mask | PropertyChangeMask | StructureNotifyMask | SubstructureNotifyMask); - if (ui::GuessWindowManager() == ui::WM_WMII) { - // wmii says that it supports _NET_ACTIVE_WINDOW but does not. - // https://code.google.com/p/wmii/issues/detail?id=266 - wm_supports_active_window_ = false; - } else { - wm_supports_active_window_ = - ui::WmSupportsHint(atom_cache_.GetAtom("_NET_ACTIVE_WINDOW")); - } + wm_supports_active_window_ = false; } X11DesktopHandler::~X11DesktopHandler() { @@ -175,8 +192,10 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { ::Window window; if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && window) { - x_active_window_ = window; - OnActiveWindowChanged(window, ACTIVE); + if (!IsParentOfWindow(xdisplay_, window, current_window_)) { + x_active_window_ = window; + OnActiveWindowChanged(window, ACTIVE); + } } else { x_active_window_ = None; }