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

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: Created 4 years, 6 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 | « no previous file | 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 aa2549adc1ba8b64a6378a02d6d5eb1c05b77c08..8409cb77a1f963c893bcf1de6488839cfdd770d0 100644
--- a/ui/events/platform/x11/x11_event_source.cc
+++ b/ui/events/platform/x11/x11_event_source.cc
@@ -209,12 +209,23 @@ void X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) {
void X11EventSource::PostDispatchEvent(XEvent* xevent) {
if (xevent->type == GenericEvent &&
- (xevent->xgeneric.evtype == XI_HierarchyChanged ||
- xevent->xgeneric.evtype == XI_DeviceChanged)) {
+ xevent->xgeneric.evtype == XI_HierarchyChanged) {
UpdateDeviceList();
hotplug_event_handler_->OnHotplugEvent();
}
+ if (xevent->type == GenericEvent &&
+ xevent->xgeneric.evtype == XI_DeviceChanged) {
+ XIDeviceChangedEvent* xev =
+ static_cast<XIDeviceChangedEvent*>(xevent->xcookie.data);
+ if (xev->reason == XIDeviceChange) {
+ UpdateDeviceList();
+ hotplug_event_handler_->OnHotplugEvent();
+ } else { // XISlaveSwitch
+ ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses();
+ }
+ }
+
sadrul 2016/06/20 19:37:30 How about: bool should_update_list = false; i
Will Shackleton 2016/06/21 16:27:46 Done.
if (xevent->type == EnterNotify &&
xevent->xcrossing.detail != NotifyInferior &&
xevent->xcrossing.mode != NotifyUngrab) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698