Chromium Code Reviews| Index: ui/events/platform/x11/x11_event_source.cc |
| diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc |
| index aa2549adc1ba8b64a6378a02d6d5eb1c05b77c08..a5795792f2a8a86a3becc9d434fc96bf22be31a2 100644 |
| --- a/ui/events/platform/x11/x11_event_source.cc |
| +++ b/ui/events/platform/x11/x11_event_source.cc |
| @@ -208,9 +208,25 @@ void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) { |
| } |
| void X11EventSource::PostDispatchEvent(XEvent* xevent) { |
| - if (xevent->type == GenericEvent && |
| - (xevent->xgeneric.evtype == XI_HierarchyChanged || |
| - xevent->xgeneric.evtype == XI_DeviceChanged)) { |
| + bool should_update_device_list = false; |
| + |
| + if (xevent->type == GenericEvent) { |
| + if (xevent->xgeneric.evtype == XI_HierarchyChanged) { |
| + should_update_device_list = true; |
| + } else if (xevent->xgeneric.evtype == XI_DeviceChanged) { |
| + XIDeviceChangedEvent* xev = |
| + static_cast<XIDeviceChangedEvent*>(xevent->xcookie.data); |
| + if (xev->reason == XIDeviceChange) { |
| + should_update_device_list = true; |
| + } else { |
| + DCHECK_EQ(XISlaveSwitch, xev->reason); |
| + ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses( |
| + xev->sourceid); |
|
sadrul
2016/06/27 14:49:21
Can |xev->sourceid| here be really -1?
Will Shackleton
2016/07/12 16:05:04
There are other places |InvalidateScrollClasses| i
|
| + } |
| + } |
| + } |
| + |
| + if (should_update_device_list) { |
| UpdateDeviceList(); |
| hotplug_event_handler_->OnHotplugEvent(); |
| } |