| 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..4d3d3fbd989f3f7c2e89c5308d2c14c799d6d39d
|
| --- /dev/null
|
| +++ b/ui/platform_window/x11/x11_window_ozone.cc
|
| @@ -0,0 +1,64 @@
|
| +// 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 "ui/events/event.h"
|
| +#include "ui/events/ozone/events_ozone.h"
|
| +#include "ui/events/platform/x11/x11_event_source.h"
|
| +#include "ui/events/x/events_x_utils.h"
|
| +#include "ui/gfx/geometry/point.h"
|
| +
|
| +namespace ui {
|
| +
|
| +X11WindowOzone::X11WindowOzone(PlatformWindowDelegate* delegate)
|
| + : X11WindowBase(delegate) {}
|
| +
|
| +X11WindowOzone::~X11WindowOzone() {
|
| + Destroy();
|
| +}
|
| +
|
| +void X11WindowOzone::Create() {
|
| + DCHECK(X11EventSource::GetInstance());
|
| + X11EventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
| +
|
| + DCHECK(X11EventSourceOzone::GetInstance());
|
| + X11EventSourceOzone::GetInstance()->AddXEventDispatcher(this);
|
| +
|
| + X11WindowBase::Create();
|
| +}
|
| +
|
| +void X11WindowOzone::Destroy() {
|
| + X11EventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
| + X11EventSourceOzone::GetInstance()->RemoveXEventDispatcher(this);
|
| +}
|
| +
|
| +void X11WindowOzone::Close() {
|
| + Destroy();
|
| + X11WindowBase::Destroy();
|
| +}
|
| +
|
| +void X11WindowOzone::SetCursor(PlatformCursor cursor) {}
|
| +
|
| +bool X11WindowOzone::DispatchXEvent(XEvent* xev) {
|
| + if (XWindowFromXEvent(*xev) != xwindow())
|
| + 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 true;
|
| +}
|
| +
|
| +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
|
|
|