| 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> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return true; | 79 return true; |
| 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( | |
| 90 new X11HotplugEventHandler(DeviceDataManager::GetInstance())); | |
| 91 InitializeXInput2(display_); | 89 InitializeXInput2(display_); |
| 92 InitializeXkb(display_); | 90 InitializeXkb(display_); |
| 93 | |
| 94 // Force the initial device query to have an update list of active devices. | |
| 95 hotplug_event_handler_->OnHotplugEvent(); | |
| 96 } | 91 } |
| 97 | 92 |
| 98 X11EventSource::~X11EventSource() { | 93 X11EventSource::~X11EventSource() { |
| 99 } | 94 } |
| 100 | 95 |
| 101 // static | 96 // static |
| 102 X11EventSource* X11EventSource::GetInstance() { | 97 X11EventSource* X11EventSource::GetInstance() { |
| 103 return static_cast<X11EventSource*>(PlatformEventSource::GetInstance()); | 98 return static_cast<X11EventSource*>(PlatformEventSource::GetInstance()); |
| 104 } | 99 } |
| 105 | 100 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 143 |
| 149 if (have_cookie) | 144 if (have_cookie) |
| 150 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 145 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
| 151 return action; | 146 return action; |
| 152 } | 147 } |
| 153 | 148 |
| 154 void X11EventSource::StopCurrentEventStream() { | 149 void X11EventSource::StopCurrentEventStream() { |
| 155 continue_stream_ = false; | 150 continue_stream_ = false; |
| 156 } | 151 } |
| 157 | 152 |
| 153 void X11EventSource::OnDispatcherListChanged() { |
| 154 if (!hotplug_event_handler_) { |
| 155 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
| 156 // Force the initial device query to have an update list of active devices. |
| 157 hotplug_event_handler_->OnHotplugEvent(); |
| 158 } |
| 159 } |
| 160 |
| 158 } // namespace ui | 161 } // namespace ui |
| OLD | NEW |