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

Unified Diff: ui/ozone/platform/wayland/wayland_window.cc

Issue 1712103002: ozone/platform/wayland: Implement pointer handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move declaration of WaylandWindow::FromSurface to top of class Created 4 years, 10 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
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();
}

Powered by Google App Engine
This is Rietveld 408576698