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

Side by Side Diff: ui/events/devices/x11/device_data_manager_x11.cc

Issue 2077163003: Reduced number of UpdateDeviceList calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied comments, added functionality to only invalidate current scroll device 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 unified diff | Download patch
OLDNEW
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/devices/x11/device_data_manager_x11.h" 5 #include "ui/events/devices/x11/device_data_manager_x11.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <X11/extensions/XInput.h> 8 #include <X11/extensions/XInput.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 continue; 553 continue;
554 if (i == horizontal_number) { 554 if (i == horizontal_number) {
555 *x_offset = ExtractAndUpdateScrollOffset(&info->horizontal, *valuators); 555 *x_offset = ExtractAndUpdateScrollOffset(&info->horizontal, *valuators);
556 } else if (i == vertical_number) { 556 } else if (i == vertical_number) {
557 *y_offset = ExtractAndUpdateScrollOffset(&info->vertical, *valuators); 557 *y_offset = ExtractAndUpdateScrollOffset(&info->vertical, *valuators);
558 } 558 }
559 valuators++; 559 valuators++;
560 } 560 }
561 } 561 }
562 562
563 void DeviceDataManagerX11::InvalidateScrollClasses() { 563 void DeviceDataManagerX11::InvalidateScrollClasses(int device_id) {
564 for (int i = 0; i < kMaxDeviceNum; i++) { 564 if (device_id == -1) {
565 scroll_data_[i].horizontal.seen = false; 565 for (int i = 0; i < kMaxDeviceNum; i++) {
566 scroll_data_[i].vertical.seen = false; 566 scroll_data_[i].horizontal.seen = false;
567 scroll_data_[i].vertical.seen = false;
568 }
569 } else {
570 if (device_id < 0 || device_id >= kMaxDeviceNum)
571 return;
572 scroll_data_[device_id].horizontal.seen = false;
573 scroll_data_[device_id].vertical.seen = false;
567 } 574 }
568 } 575 }
569 576
570 void DeviceDataManagerX11::GetFlingData(const XEvent& xev, 577 void DeviceDataManagerX11::GetFlingData(const XEvent& xev,
571 float* vx, 578 float* vx,
572 float* vy, 579 float* vy,
573 float* vx_ordinal, 580 float* vx_ordinal,
574 float* vy_ordinal, 581 float* vy_ordinal,
575 bool* is_cancel) { 582 bool* is_cancel) {
576 *vx = 0; 583 *vx = 0;
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 } else { 887 } else {
881 keyboards.erase(it); 888 keyboards.erase(it);
882 ++blocked_iter; 889 ++blocked_iter;
883 } 890 }
884 } 891 }
885 // Notify base class of updated list. 892 // Notify base class of updated list.
886 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); 893 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards);
887 } 894 }
888 895
889 } // namespace ui 896 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698