Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: ui/platform_window/x11/x11_window_ozone.cc

Issue 1602173005: Add PlatformWindow/Event related code for Ozone X11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final fixes for comments + tests. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « ui/platform_window/x11/x11_window_ozone.h ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698