Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Unified Diff: services/ui/ws/window_manager_state.cc

Issue 2863913004: chromeos: makes mus send keyevents to display root when nothing has focus (Closed)
Patch Set: moar Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/window_manager_state.h ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e0f1cc9e674d160b96262e26c94ec2dd3090f2ba 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -375,15 +375,24 @@ 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 GetWindowManagerRoot(display_root_ptr.get());
}
NOTREACHED();
return nullptr;
}
+ServerWindow* WindowManagerState::GetWindowManagerRoot(
+ WindowManagerDisplayRoot* display_root) {
+ if (window_tree_->automatically_create_display_roots())
+ return display_root->root();
+ DCHECK_EQ(1u, display_root->root()->children().size());
+ return display_root->root()->children()[0];
sadrul 2017/05/08 15:24:19 Maybe there should be a WindowManagerDisplayRoot::
sky 2017/05/08 15:53:00 Good idea. Done.
+}
+
void WindowManagerState::OnEventAck(mojom::WindowTree* tree,
mojom::EventResult result) {
DCHECK(in_flight_event_details_);
@@ -458,7 +467,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 +573,19 @@ 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 GetWindowManagerRoot(display_root_ptr.get());
+ }
+ }
+ if (!window_manager_display_roots_.empty())
+ return GetWindowManagerRoot(window_manager_display_roots_.begin()->get());
+ return nullptr;
}
void WindowManagerState::SetNativeCapture(ServerWindow* window) {
« no previous file with comments | « services/ui/ws/window_manager_state.h ('k') | services/ui/ws/window_tree_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698