OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/platform/x11/x11_event_source.h" | 5 #include "ui/events/platform/x11/x11_event_source.h" |
6 | 6 |
7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
8 #include <X11/X.h> | 8 #include <X11/X.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/XKBlib.h> | 10 #include <X11/XKBlib.h> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "ui/events/event_utils.h" | 13 #include "ui/events/event_utils.h" |
14 #include "ui/events/platform/platform_event_dispatcher.h" | 14 #include "ui/events/platform/platform_event_dispatcher.h" |
| 15 #include "ui/events/x/device_data_manager_x11.h" |
15 #include "ui/gfx/x/x11_types.h" | 16 #include "ui/gfx/x/x11_types.h" |
16 | 17 |
17 namespace ui { | 18 namespace ui { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 int g_xinput_opcode = -1; | 22 int g_xinput_opcode = -1; |
22 | 23 |
23 bool InitializeXInput2(XDisplay* display) { | 24 bool InitializeXInput2(XDisplay* display) { |
24 if (!display) | 25 if (!display) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 77 |
77 return true; | 78 return true; |
78 } | 79 } |
79 | 80 |
80 } // namespace | 81 } // namespace |
81 | 82 |
82 X11EventSource::X11EventSource(XDisplay* display) | 83 X11EventSource::X11EventSource(XDisplay* display) |
83 : display_(display), | 84 : display_(display), |
84 continue_stream_(true) { | 85 continue_stream_(true) { |
85 CHECK(display_); | 86 CHECK(display_); |
| 87 DeviceDataManagerX11::CreateInstance(); |
86 InitializeXInput2(display_); | 88 InitializeXInput2(display_); |
87 InitializeXkb(display_); | 89 InitializeXkb(display_); |
88 } | 90 } |
89 | 91 |
90 X11EventSource::~X11EventSource() { | 92 X11EventSource::~X11EventSource() { |
91 } | 93 } |
92 | 94 |
93 // static | 95 // static |
94 X11EventSource* X11EventSource::GetInstance() { | 96 X11EventSource* X11EventSource::GetInstance() { |
95 return static_cast<X11EventSource*>(PlatformEventSource::GetInstance()); | 97 return static_cast<X11EventSource*>(PlatformEventSource::GetInstance()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (have_cookie) | 142 if (have_cookie) |
141 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 143 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
142 return action; | 144 return action; |
143 } | 145 } |
144 | 146 |
145 void X11EventSource::StopCurrentEventStream() { | 147 void X11EventSource::StopCurrentEventStream() { |
146 continue_stream_ = false; | 148 continue_stream_ = false; |
147 } | 149 } |
148 | 150 |
149 } // namespace ui | 151 } // namespace ui |
OLD | NEW |