Index: ui/platform_window/x11/x11_window_ozone.cc |
diff --git a/ui/platform_window/x11/x11_window_ozone.cc b/ui/platform_window/x11/x11_window_ozone.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6193b1f70d99448ae090874fa7f0e199bb7409cb |
--- /dev/null |
+++ b/ui/platform_window/x11/x11_window_ozone.cc |
@@ -0,0 +1,51 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ui/platform_window/x11/x11_window_ozone.h" |
+ |
+#include <X11/Xlib.h> |
+ |
+#include "ui/events/event.h" |
+#include "ui/events/ozone/events_ozone.h" |
+#include "ui/events/platform/x11/x11_event_source.h" |
+#include "ui/gfx/geometry/point.h" |
+ |
+namespace ui { |
+ |
+X11WindowOzone::X11WindowOzone(X11EventSourceLibevent* event_source, |
+ PlatformWindowDelegate* delegate) |
+ : X11WindowBase(delegate), event_source_(event_source) { |
+ DCHECK(event_source_); |
+ event_source_->AddPlatformEventDispatcher(this); |
+ event_source_->AddXEventDispatcher(this); |
+} |
+ |
+X11WindowOzone::~X11WindowOzone() { |
+ event_source_->RemovePlatformEventDispatcher(this); |
+ event_source_->RemoveXEventDispatcher(this); |
+} |
+ |
+void X11WindowOzone::SetCursor(PlatformCursor cursor) {} |
+ |
+bool X11WindowOzone::DispatchXEvent(XEvent* xev) { |
+ if (!IsEventForXWindow(*xev)) |
+ return false; |
+ |
+ ProcessXWindowEvent(xev); |
+ return true; |
+} |
+ |
+bool X11WindowOzone::CanDispatchEvent(const PlatformEvent& event) { |
+ // TODO(kylechar): This is broken, there is no way to include XID of XWindow |
+ // in ui::Event. Fix or use similar hack to DrmWindowHost. |
+ return xwindow() != None; |
+} |
+ |
+uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& platform_event) { |
+ Event* event = static_cast<Event*>(platform_event); |
+ delegate()->DispatchEvent(event); |
+ return POST_DISPATCH_STOP_PROPAGATION; |
+} |
+ |
+} // namespace ui |