Chromium Code Reviews| 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..fef643f06c2f549783fbffcb5b929ae94e0ba3ef |
| --- /dev/null |
| +++ b/ui/platform_window/x11/x11_window_ozone.cc |
| @@ -0,0 +1,49 @@ |
| +// 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/x/events_x_utils.h" |
| +#include "ui/gfx/geometry/point.h" |
| + |
| +namespace ui { |
| + |
| +X11WindowOzone::X11WindowOzone(PlatformWindowDelegate* delegate) |
| + : X11WindowBase(delegate) {} |
| + |
| +X11WindowOzone::~X11WindowOzone() {} |
| + |
| +void X11WindowOzone::Create() { |
| + DCHECK(X11EventSourceOzone::GetInstance()); |
| + X11EventSourceOzone::GetInstance()->AddXEventDispatcher(this); |
| + X11WindowBase::Create(); |
| +} |
| + |
| +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) { |
| + // This is broken, there is no way to include XID of XWindow in ui::Event. |
|
sadrul
2016/02/02 16:33:54
Should this do things similar to DrmWindowHost::Ca
kylechar
2016/02/02 19:01:42
Either use that type of hack or fix things so that
|
| + return true; |
| +} |
| + |
| +uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& platform_event) { |
| + Event* event = static_cast<Event*>(platform_event); |
| + DispatchEventFromNativeUiEvent( |
|
sadrul
2016/02/02 16:33:54
I don't think we need to use this, and instead can
kylechar
2016/02/02 19:01:42
I have no idea (I definitely copied this in from t
|
| + event, base::Bind(&PlatformWindowDelegate::DispatchEvent, |
| + base::Unretained(delegate_))); |
| + |
| + return POST_DISPATCH_STOP_PROPAGATION; |
| +} |
| + |
| +} // namespace ui |