| 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/devices/x11/device_data_manager_x11.h" |
| 13 #include "ui/events/event_utils.h" | 14 #include "ui/events/event_utils.h" |
| 14 #include "ui/events/platform/platform_event_dispatcher.h" | 15 #include "ui/events/platform/platform_event_dispatcher.h" |
| 15 #include "ui/events/x/device_data_manager_x11.h" | 16 #include "ui/events/platform/x11/x11_hotplug_event_handler.h" |
| 16 #include "ui/events/x/hotplug_event_handler_x11.h" | |
| 17 #include "ui/gfx/x/x11_types.h" | 17 #include "ui/gfx/x/x11_types.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 int g_xinput_opcode = -1; | 23 int g_xinput_opcode = -1; |
| 24 | 24 |
| 25 bool InitializeXInput2(XDisplay* display) { | 25 bool InitializeXInput2(XDisplay* display) { |
| 26 if (!display) | 26 if (!display) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 X11EventSource::X11EventSource(XDisplay* display) | 84 X11EventSource::X11EventSource(XDisplay* display) |
| 85 : display_(display), | 85 : display_(display), |
| 86 continue_stream_(true) { | 86 continue_stream_(true) { |
| 87 CHECK(display_); | 87 CHECK(display_); |
| 88 DeviceDataManagerX11::CreateInstance(); | 88 DeviceDataManagerX11::CreateInstance(); |
| 89 hotplug_event_handler_.reset( | 89 hotplug_event_handler_.reset( |
| 90 new HotplugEventHandlerX11(DeviceDataManager::GetInstance())); | 90 new X11HotplugEventHandler(DeviceDataManager::GetInstance())); |
| 91 InitializeXInput2(display_); | 91 InitializeXInput2(display_); |
| 92 InitializeXkb(display_); | 92 InitializeXkb(display_); |
| 93 | 93 |
| 94 // Force the initial device query to have an update list of active devices. | 94 // Force the initial device query to have an update list of active devices. |
| 95 hotplug_event_handler_->OnHotplugEvent(); | 95 hotplug_event_handler_->OnHotplugEvent(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 X11EventSource::~X11EventSource() { | 98 X11EventSource::~X11EventSource() { |
| 99 } | 99 } |
| 100 | 100 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (have_cookie) | 149 if (have_cookie) |
| 150 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 150 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
| 151 return action; | 151 return action; |
| 152 } | 152 } |
| 153 | 153 |
| 154 void X11EventSource::StopCurrentEventStream() { | 154 void X11EventSource::StopCurrentEventStream() { |
| 155 continue_stream_ = false; | 155 continue_stream_ = false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace ui | 158 } // namespace ui |
| OLD | NEW |