diff options
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/mus/platform_window_mus.cc | 16 | ||||
-rw-r--r-- | ui/views/mus/platform_window_mus.h | 11 |
2 files changed, 18 insertions, 9 deletions
diff --git a/ui/views/mus/platform_window_mus.cc b/ui/views/mus/platform_window_mus.cc index 5111b70..e8a5350 100644 --- a/ui/views/mus/platform_window_mus.cc +++ b/ui/views/mus/platform_window_mus.cc @@ -28,6 +28,7 @@ PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, DCHECK(delegate_); DCHECK(mus_window_); mus_window_->AddObserver(this); + mus_window_->set_input_event_handler(this); // We need accelerated widget numbers to be different for each // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t @@ -47,6 +48,7 @@ PlatformWindowMus::~PlatformWindowMus() { if (!mus_window_) return; mus_window_->RemoveObserver(this); + mus_window_->set_input_event_handler(nullptr); mus_window_->Destroy(); } @@ -166,12 +168,6 @@ void PlatformWindowMus::OnWindowPredefinedCursorChanged( last_cursor_ = cursor; } -void PlatformWindowMus::OnWindowInputEvent(mus::Window* view, - const mus::mojom::EventPtr& event) { - scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event>>()); - delegate_->DispatchEvent(ui_event.get()); -} - void PlatformWindowMus::OnWindowSharedPropertyChanged( mus::Window* window, const std::string& name, @@ -205,4 +201,12 @@ void PlatformWindowMus::OnWindowSharedPropertyChanged( delegate_->OnWindowStateChanged(state); } +void PlatformWindowMus::OnWindowInputEvent( + mus::Window* view, + mus::mojom::EventPtr event, + scoped_ptr<base::Closure>* ack_callback) { + scoped_ptr<ui::Event> ui_event(event.To<scoped_ptr<ui::Event>>()); + delegate_->DispatchEvent(ui_event.get()); +} + } // namespace views diff --git a/ui/views/mus/platform_window_mus.h b/ui/views/mus/platform_window_mus.h index 69c6dd3..f3e2a1c 100644 --- a/ui/views/mus/platform_window_mus.h +++ b/ui/views/mus/platform_window_mus.h @@ -9,6 +9,7 @@ #include <vector> #include "base/macros.h" +#include "components/mus/public/cpp/input_event_handler.h" #include "components/mus/public/cpp/window_observer.h" #include "ui/platform_window/platform_window.h" #include "ui/views/mus/mus_export.h" @@ -17,7 +18,8 @@ namespace views { class VIEWS_MUS_EXPORT PlatformWindowMus : public NON_EXPORTED_BASE(ui::PlatformWindow), - public mus::WindowObserver { + public mus::WindowObserver, + public NON_EXPORTED_BASE(mus::InputEventHandler) { public: PlatformWindowMus(ui::PlatformWindowDelegate* delegate, mus::Window* mus_window); @@ -57,14 +59,17 @@ class VIEWS_MUS_EXPORT PlatformWindowMus mus::Window* lost_focus) override; void OnWindowPredefinedCursorChanged(mus::Window* window, mus::mojom::Cursor cursor) override; - void OnWindowInputEvent(mus::Window* view, - const mus::mojom::EventPtr& event) override; void OnWindowSharedPropertyChanged( mus::Window* window, const std::string& name, const std::vector<uint8_t>* old_data, const std::vector<uint8_t>* new_data) override; + // mus::InputEventHandler: + void OnWindowInputEvent(mus::Window* view, + mus::mojom::EventPtr event, + scoped_ptr<base::Closure>* ack_callback) override; + ui::PlatformWindowDelegate* delegate_; mus::Window* mus_window_; mus::mojom::ShowState show_state_; |