| Index: services/ui/ws/window_manager_state.cc
|
| diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
|
| index 295eb4dbd82cdeea189d594a7e6b9f7c774b7c0a..00347db7ad2cc15ee378c6f95c68931436a10dd7 100644
|
| --- a/services/ui/ws/window_manager_state.cc
|
| +++ b/services/ui/ws/window_manager_state.cc
|
| @@ -375,10 +375,11 @@ void WindowManagerState::SetAllRootWindowsVisible(bool value) {
|
| display_root_ptr->root()->SetVisible(value);
|
| }
|
|
|
| -ServerWindow* WindowManagerState::GetWindowManagerRoot(ServerWindow* window) {
|
| +ServerWindow* WindowManagerState::GetWindowManagerRootForDisplayRoot(
|
| + ServerWindow* window) {
|
| for (auto& display_root_ptr : window_manager_display_roots_) {
|
| if (display_root_ptr->root()->parent() == window)
|
| - return display_root_ptr->root();
|
| + return display_root_ptr->GetClientVisibileRoot();
|
| }
|
| NOTREACHED();
|
| return nullptr;
|
| @@ -458,7 +459,7 @@ void WindowManagerState::DispatchInputEventToWindowImpl(
|
| base::WeakPtr<Accelerator> accelerator) {
|
| DCHECK(target);
|
| if (target->parent() == nullptr)
|
| - target = GetWindowManagerRoot(target);
|
| + target = GetWindowManagerRootForDisplayRoot(target);
|
|
|
| if (event.IsMousePointerEvent()) {
|
| DCHECK(event_dispatcher_.mouse_cursor_source_window());
|
| @@ -564,7 +565,18 @@ void WindowManagerState::SetFocusedWindowFromEventDispatcher(
|
| }
|
|
|
| ServerWindow* WindowManagerState::GetFocusedWindowForEventDispatcher() {
|
| - return window_server()->GetFocusedWindow();
|
| + ServerWindow* focused_window = window_server()->GetFocusedWindow();
|
| + if (focused_window)
|
| + return focused_window;
|
| +
|
| + // When none of the windows have focus return the window manager's root.
|
| + for (auto& display_root_ptr : window_manager_display_roots_) {
|
| + if (display_root_ptr->display()->GetId() == event_processing_display_id_)
|
| + return display_root_ptr->GetClientVisibileRoot();
|
| + }
|
| + if (!window_manager_display_roots_.empty())
|
| + return (*window_manager_display_roots_.begin())->GetClientVisibileRoot();
|
| + return nullptr;
|
| }
|
|
|
| void WindowManagerState::SetNativeCapture(ServerWindow* window) {
|
| @@ -682,7 +694,7 @@ ServerWindow* WindowManagerState::GetRootWindowContaining(
|
| gfx::Point origin =
|
| target_display_root->display()->GetDisplay().bounds().origin();
|
| *location -= origin.OffsetFromOrigin();
|
| - return target_display_root->root();
|
| + return target_display_root->GetClientVisibileRoot();
|
| }
|
|
|
| void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) {
|
|
|