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 337273f189ed4abb2d15bf270e5031434208116f..0729ce713d95952bfe18cf5e4feb1eb201d1c5dd 100644 |
--- a/ui/events/platform/x11/x11_event_source.cc |
+++ b/ui/events/platform/x11/x11_event_source.cc |
@@ -206,9 +206,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); |
bokan
2016/07/13 14:45:50
Is it guaranteed that there won't ever be a new re
Will Shackleton
2016/07/14 18:11:10
Hah. Not in the current X11 spec but I'll make thi
|
+ ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses( |
+ xev->sourceid); |
+ } |
+ } |
+ } |
+ |
+ if (should_update_device_list) { |
UpdateDeviceList(); |
hotplug_event_handler_->OnHotplugEvent(); |
} |
@@ -217,7 +233,7 @@ void X11EventSource::PostDispatchEvent(XEvent* xevent) { |
xevent->xcrossing.detail != NotifyInferior && |
xevent->xcrossing.mode != NotifyUngrab) { |
// Clear stored scroll data |
- ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); |
+ ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(-1); |
bokan
2016/07/13 14:45:50
Make the -1 an Enum (e.g. ALL_DEVICES) for readabi
Will Shackleton
2016/07/14 18:11:09
Done.
|
} |
} |