| Index: ui/ozone/platform/wayland/wayland_window.cc
|
| diff --git a/ui/ozone/platform/wayland/wayland_window.cc b/ui/ozone/platform/wayland/wayland_window.cc
|
| index 06944f8deb21390ba3ca04ba2cfcd88e0bd2226e..bf280b8d0c26d15a67351b76cd4d8b847be486d1 100644
|
| --- a/ui/ozone/platform/wayland/wayland_window.cc
|
| +++ b/ui/ozone/platform/wayland/wayland_window.cc
|
| @@ -7,6 +7,8 @@
|
| #include <xdg-shell-unstable-v5-client-protocol.h>
|
|
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "ui/events/event.h"
|
| +#include "ui/events/ozone/events_ozone.h"
|
| #include "ui/ozone/platform/wayland/wayland_display.h"
|
| #include "ui/platform_window/platform_window_delegate.h"
|
|
|
| @@ -19,10 +21,17 @@ WaylandWindow::WaylandWindow(PlatformWindowDelegate* delegate,
|
|
|
| WaylandWindow::~WaylandWindow() {
|
| if (xdg_surface_) {
|
| + PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
| display_->RemoveWindow(this);
|
| }
|
| }
|
|
|
| +// static
|
| +WaylandWindow* WaylandWindow::FromSurface(wl_surface* surface) {
|
| + return static_cast<WaylandWindow*>(
|
| + wl_proxy_get_user_data(reinterpret_cast<wl_proxy*>(surface)));
|
| +}
|
| +
|
| bool WaylandWindow::Initialize() {
|
| static const xdg_surface_listener xdg_surface_listener = {
|
| &WaylandWindow::Configure, &WaylandWindow::Close,
|
| @@ -43,6 +52,7 @@ bool WaylandWindow::Initialize() {
|
| xdg_surface_add_listener(xdg_surface_.get(), &xdg_surface_listener, this);
|
|
|
| display_->AddWindow(this);
|
| + PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
| delegate_->OnAcceleratedWidgetAvailable(surface_.id(), 1.f);
|
|
|
| return true;
|
| @@ -138,6 +148,21 @@ PlatformImeController* WaylandWindow::GetPlatformImeController() {
|
| return nullptr;
|
| }
|
|
|
| +bool WaylandWindow::CanDispatchEvent(const PlatformEvent& native_event) {
|
| + Event* event = static_cast<Event*>(native_event);
|
| + if (event->IsMouseEvent())
|
| + return has_pointer_focus_;
|
| + return false;
|
| +}
|
| +
|
| +uint32_t WaylandWindow::DispatchEvent(const PlatformEvent& native_event) {
|
| + DispatchEventFromNativeUiEvent(
|
| + native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent,
|
| + base::Unretained(delegate_)));
|
| + return POST_DISPATCH_STOP_PROPAGATION;
|
| +}
|
| +
|
| +// static
|
| void WaylandWindow::Configure(void* data,
|
| xdg_surface* obj,
|
| int32_t width,
|
| @@ -154,6 +179,7 @@ void WaylandWindow::Configure(void* data,
|
| window->pending_configure_serial_ = serial;
|
| }
|
|
|
| +// static
|
| void WaylandWindow::Close(void* data, xdg_surface* obj) {
|
| NOTIMPLEMENTED();
|
| }
|
|
|