Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: ui/events/platform/x11/x11_event_source.cc

Issue 2077163003: Reduced number of UpdateDeviceList calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed ALL_DEVICES to kAllDevices Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ea5638d34ec9fc54873db958277a390feb370098 100644
--- a/ui/events/platform/x11/x11_event_source.cc
+++ b/ui/events/platform/x11/x11_event_source.cc
@@ -206,9 +206,24 @@ 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 if (xev->reason == XISlaveSwitch) {
+ ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(
+ xev->sourceid);
+ }
+ }
+ }
+
+ if (should_update_device_list) {
UpdateDeviceList();
hotplug_event_handler_->OnHotplugEvent();
}
@@ -217,7 +232,8 @@ 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(
+ DeviceDataManagerX11::kAllDevices);
}
}
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698