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

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: GetClientVisibleRoot 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_server.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..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) {
« no previous file with comments | « services/ui/ws/window_manager_state.h ('k') | services/ui/ws/window_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698