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

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: Fix deps problem. 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 "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(PlatformWindowDelegate* delegate)
16 : X11WindowBase(delegate) {}
17
18 X11WindowOzone::~X11WindowOzone() {
19 Destroy();
20 }
21
22 void X11WindowOzone::Create() {
23 DCHECK(X11EventSource::GetInstance());
24 X11EventSource::GetInstance()->AddPlatformEventDispatcher(this);
25
26 DCHECK(X11EventSourceOzone::GetInstance());
27 X11EventSourceOzone::GetInstance()->AddXEventDispatcher(this);
28
29 X11WindowBase::Create();
30 }
31
32 void X11WindowOzone::Destroy() {
33 X11EventSource::GetInstance()->RemovePlatformEventDispatcher(this);
34 X11EventSourceOzone::GetInstance()->RemoveXEventDispatcher(this);
35 }
36
37 void X11WindowOzone::Close() {
38 Destroy();
39 X11WindowBase::Destroy();
40 }
41
42 void X11WindowOzone::SetCursor(PlatformCursor cursor) {}
43
44 bool X11WindowOzone::DispatchXEvent(XEvent* xev) {
45 if (XWindowFromXEvent(*xev) != xwindow())
46 return false;
47
48 ProcessXWindowEvent(xev);
49 return true;
50 }
51
52 bool X11WindowOzone::CanDispatchEvent(const PlatformEvent& event) {
53 // TODO(kylechar): This is broken, there is no way to include XID of XWindow
54 // in ui::Event. Fix or use similar hack to DrmWindowHost.
55 return true;
56 }
57
58 uint32_t X11WindowOzone::DispatchEvent(const PlatformEvent& platform_event) {
59 Event* event = static_cast<Event*>(platform_event);
60 delegate()->DispatchEvent(event);
61 return POST_DISPATCH_STOP_PROPAGATION;
62 }
63
64 } // namespace ui
OLDNEW
« ui/events/platform/x11/x11_event_source_ozone.cc ('K') | « ui/platform_window/x11/x11_window_ozone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698