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

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: Rebase. 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(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698