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 "ui/events/event.h" |
| 8 #include "ui/events/ozone/events_ozone.h" |
| 9 #include "ui/events/platform/x11/x11_event_source.h" |
| 10 #include "ui/events/x/events_x_utils.h" |
| 11 #include "ui/gfx/geometry/point.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 X11WindowOzone::X11WindowOzone(X11EventSourceLibevent* event_source, |
| 16 PlatformWindowDelegate* delegate) |
| 17 : X11WindowBase(delegate), event_source_(event_source) { |
| 18 DCHECK(event_source_); |
| 19 event_source_->AddPlatformEventDispatcher(this); |
| 20 event_source_->AddXEventDispatcher(this); |
| 21 } |
| 22 |
| 23 X11WindowOzone::~X11WindowOzone() { |
| 24 event_source_->RemovePlatformEventDispatcher(this); |
| 25 event_source_->RemoveXEventDispatcher(this); |
| 26 } |
| 27 |
| 28 void X11WindowOzone::SetCursor(PlatformCursor cursor) {} |
| 29 |
| 30 bool X11WindowOzone::DispatchXEvent(XEvent* xev) { |
| 31 if (!HasXWindow() || XWindowFromXEvent(*xev) != xwindow()) |
| 32 return false; |
| 33 |
| 34 ProcessXWindowEvent(xev); |
| 35 return true; |
| 36 } |
| 37 |
| 38 bool X11WindowOzone::CanDispatchEvent(const PlatformEvent& event) { |
| 39 // TODO(kylechar): This is broken, there is no way to include XID of XWindow |
| 40 // in ui::Event. Fix or use similar hack to DrmWindowHost. |
| 41 return HasXWindow(); |
| 42 } |
| 43 |
| 44 uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& platform_event) { |
| 45 Event* event = static_cast<Event*>(platform_event); |
| 46 delegate()->DispatchEvent(event); |
| 47 return POST_DISPATCH_STOP_PROPAGATION; |
| 48 } |
| 49 |
| 50 } // namespace ui |
OLD | NEW |