Chromium Code Reviews| Index: components/mus/ws/window_tree_host_impl.cc |
| diff --git a/components/mus/ws/window_tree_host_impl.cc b/components/mus/ws/window_tree_host_impl.cc |
| index 7360710d1e66021f04d47313a1bd18a1432f231d..e0d16873364c660696325edadb9ca5c035640cf9 100644 |
| --- a/components/mus/ws/window_tree_host_impl.cc |
| +++ b/components/mus/ws/window_tree_host_impl.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/debug/debugger.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "components/mus/common/types.h" |
| +#include "components/mus/public/interfaces/input_event_constants.mojom.h" |
| #include "components/mus/ws/connection_manager.h" |
| #include "components/mus/ws/display_manager.h" |
| #include "components/mus/ws/focus_controller.h" |
| @@ -43,7 +44,8 @@ WindowTreeHostImpl::WindowTreeHostImpl( |
| display_manager_( |
| DisplayManager::Create(app_impl, gpu_state, surfaces_state)), |
| window_manager_(window_manager.Pass()), |
| - tree_awaiting_input_ack_(nullptr) { |
| + tree_awaiting_input_ack_(nullptr), |
| + last_cursor_(0) { |
| display_manager_->Init(this); |
| if (client_) { |
| client_.set_connection_error_handler(base::Bind( |
| @@ -131,6 +133,11 @@ void WindowTreeHostImpl::SetImeVisibility(ServerWindow* window, bool visible) { |
| display_manager_->SetImeVisibility(visible); |
| } |
| +void WindowTreeHostImpl::OnCursorUpdated(ServerWindow* window) { |
| + if (window == event_dispatcher_.last_targeted_window()) |
|
sky
2015/12/01 21:48:01
Doesn't this need to be more sophisticated? What i
Elliot Glaysher
2015/12/02 20:01:32
So I might just be wrong about this, but in event_
sky
2015/12/02 21:19:41
You are correct. We currently only have implicit c
|
| + UpdateNativeCursor(window->cursor()); |
| +} |
| + |
| void WindowTreeHostImpl::SetSize(mojo::SizePtr size) { |
| display_manager_->SetViewportSize(size.To<gfx::Size>()); |
| } |
| @@ -211,6 +218,13 @@ void WindowTreeHostImpl::DispatchNextEventFromQueue() { |
| event_dispatcher_.OnEvent(next_event.Pass()); |
| } |
| +void WindowTreeHostImpl::UpdateNativeCursor(int32_t cursor_id) { |
| + if (cursor_id != last_cursor_) { |
| + display_manager_->SetCursorById(cursor_id); |
| + last_cursor_ = cursor_id; |
| + } |
| +} |
| + |
| ServerWindow* WindowTreeHostImpl::GetRootWindow() { |
| return root_.get(); |
| } |
| @@ -360,6 +374,13 @@ void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, |
| bool in_nonclient_area, |
| mojom::EventPtr event) { |
| DCHECK(!event_ack_timer_.IsRunning()); |
| + if (event->action == mojom::EventType::EVENT_TYPE_POINTER_CANCEL || |
| + event->action == mojom::EventType::EVENT_TYPE_POINTER_DOWN || |
| + event->action == mojom::EventType::EVENT_TYPE_POINTER_MOVE || |
| + event->action == mojom::EventType::EVENT_TYPE_POINTER_UP) { |
| + UpdateNativeCursor(target->cursor()); |
| + } |
| + |
| // If the event is in the non-client area the event goes to the owner of |
| // the window. Otherwise if the window is an embed root, forward to the |
| // embedded window. |