| 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/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/XKBlib.h> | 8 #include <X11/XKBlib.h> |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 203 } |
| 204 delegate_->ProcessXEvent(xevent); | 204 delegate_->ProcessXEvent(xevent); |
| 205 PostDispatchEvent(xevent); | 205 PostDispatchEvent(xevent); |
| 206 if (have_cookie) | 206 if (have_cookie) |
| 207 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); | 207 XFreeEventData(xevent->xgeneric.display, &xevent->xcookie); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void X11EventSource::PostDispatchEvent(XEvent* xevent) { | 210 void X11EventSource::PostDispatchEvent(XEvent* xevent) { |
| 211 if (xevent->type == GenericEvent && | 211 if (xevent->type == GenericEvent && |
| 212 (xevent->xgeneric.evtype == XI_HierarchyChanged || | 212 (xevent->xgeneric.evtype == XI_HierarchyChanged || |
| 213 (xevent->xgeneric.evtype == XI_DeviceChanged && | 213 xevent->xgeneric.evtype == XI_DeviceChanged)) { |
| 214 static_cast<XIDeviceChangedEvent*>(xevent->xcookie.data)->reason == | |
| 215 XIDeviceChange))) { | |
| 216 UpdateDeviceList(); | 214 UpdateDeviceList(); |
| 217 hotplug_event_handler_->OnHotplugEvent(); | 215 hotplug_event_handler_->OnHotplugEvent(); |
| 218 } | 216 } |
| 219 | 217 |
| 220 if (xevent->type == EnterNotify && | 218 if (xevent->type == EnterNotify && |
| 221 xevent->xcrossing.detail != NotifyInferior && | 219 xevent->xcrossing.detail != NotifyInferior && |
| 222 xevent->xcrossing.mode != NotifyUngrab) { | 220 xevent->xcrossing.mode != NotifyUngrab) { |
| 223 // Clear stored scroll data | 221 // Clear stored scroll data |
| 224 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); | 222 ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); |
| 225 } | 223 } |
| 226 } | 224 } |
| 227 | 225 |
| 228 void X11EventSource::StopCurrentEventStream() { | 226 void X11EventSource::StopCurrentEventStream() { |
| 229 continue_stream_ = false; | 227 continue_stream_ = false; |
| 230 } | 228 } |
| 231 | 229 |
| 232 void X11EventSource::OnDispatcherListChanged() { | 230 void X11EventSource::OnDispatcherListChanged() { |
| 233 if (!hotplug_event_handler_) { | 231 if (!hotplug_event_handler_) { |
| 234 hotplug_event_handler_.reset(new X11HotplugEventHandler()); | 232 hotplug_event_handler_.reset(new X11HotplugEventHandler()); |
| 235 // Force the initial device query to have an update list of active devices. | 233 // Force the initial device query to have an update list of active devices. |
| 236 hotplug_event_handler_->OnHotplugEvent(); | 234 hotplug_event_handler_->OnHotplugEvent(); |
| 237 } | 235 } |
| 238 } | 236 } |
| 239 | 237 |
| 240 } // namespace ui | 238 } // namespace ui |
| OLD | NEW |