OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/platform_window/x11/x11_window_ozone.h" |
| 6 |
| 7 #include <X11/Xlib.h> |
| 8 |
| 9 #include "ui/events/event.h" |
| 10 #include "ui/events/ozone/events_ozone.h" |
| 11 #include "ui/events/platform/x11/x11_event_source.h" |
| 12 #include "ui/gfx/geometry/point.h" |
| 13 |
| 14 namespace ui { |
| 15 |
| 16 X11WindowOzone::X11WindowOzone(X11EventSourceLibevent* event_source, |
| 17 PlatformWindowDelegate* delegate) |
| 18 : X11WindowBase(delegate), event_source_(event_source) { |
| 19 DCHECK(event_source_); |
| 20 event_source_->AddPlatformEventDispatcher(this); |
| 21 event_source_->AddXEventDispatcher(this); |
| 22 } |
| 23 |
| 24 X11WindowOzone::~X11WindowOzone() { |
| 25 event_source_->RemovePlatformEventDispatcher(this); |
| 26 event_source_->RemoveXEventDispatcher(this); |
| 27 } |
| 28 |
| 29 void X11WindowOzone::SetCursor(PlatformCursor cursor) {} |
| 30 |
| 31 bool X11WindowOzone::DispatchXEvent(XEvent* xev) { |
| 32 if (!IsEventForXWindow(*xev)) |
| 33 return false; |
| 34 |
| 35 ProcessXWindowEvent(xev); |
| 36 return true; |
| 37 } |
| 38 |
| 39 bool X11WindowOzone::CanDispatchEvent(const PlatformEvent& event) { |
| 40 // TODO(kylechar): This is broken, there is no way to include XID of XWindow |
| 41 // in ui::Event. Fix or use similar hack to DrmWindowHost. |
| 42 return xwindow() != None; |
| 43 } |
| 44 |
| 45 uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& platform_event) { |
| 46 Event* event = static_cast<Event*>(platform_event); |
| 47 delegate()->DispatchEvent(event); |
| 48 return POST_DISPATCH_STOP_PROPAGATION; |
| 49 } |
| 50 |
| 51 } // namespace ui |
OLD | NEW |