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

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

Issue 1930723004: Removed DeviceDataManagerX11::scrollclass_devices_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 return true; 211 return true;
212 } 212 }
213 213
214 bool DeviceDataManagerX11::IsXInput2Available() const { 214 bool DeviceDataManagerX11::IsXInput2Available() const {
215 return xi_opcode_ != -1; 215 return xi_opcode_ != -1;
216 } 216 }
217 217
218 void DeviceDataManagerX11::UpdateDeviceList(Display* display) { 218 void DeviceDataManagerX11::UpdateDeviceList(Display* display) {
219 cmt_devices_.reset(); 219 cmt_devices_.reset();
220 touchpads_.reset(); 220 touchpads_.reset();
221 scrollclass_devices_.reset();
222 master_pointers_.clear(); 221 master_pointers_.clear();
223 for (int i = 0; i < kMaxDeviceNum; ++i) { 222 for (int i = 0; i < kMaxDeviceNum; ++i) {
224 valuator_count_[i] = 0; 223 valuator_count_[i] = 0;
225 valuator_lookup_[i].clear(); 224 valuator_lookup_[i].clear();
226 data_type_lookup_[i].clear(); 225 data_type_lookup_[i].clear();
227 valuator_min_[i].clear(); 226 valuator_min_[i].clear();
228 valuator_max_[i].clear(); 227 valuator_max_[i].clear();
229 scroll_data_[i].horizontal.number = -1; 228 scroll_data_[i].horizontal.number = -1;
230 scroll_data_[i].horizontal.seen = false; 229 scroll_data_[i].horizontal.seen = false;
231 scroll_data_[i].vertical.number = -1; 230 scroll_data_[i].vertical.number = -1;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return cmt_devices_[xievent->sourceid]; 416 return cmt_devices_[xievent->sourceid];
418 } 417 }
419 418
420 int DeviceDataManagerX11::GetScrollClassEventDetail(const XEvent& xev) const { 419 int DeviceDataManagerX11::GetScrollClassEventDetail(const XEvent& xev) const {
421 if (xev.type != GenericEvent) 420 if (xev.type != GenericEvent)
422 return SCROLL_TYPE_NO_SCROLL; 421 return SCROLL_TYPE_NO_SCROLL;
423 422
424 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev.xcookie.data); 423 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev.xcookie.data);
425 if (xievent->sourceid >= kMaxDeviceNum) 424 if (xievent->sourceid >= kMaxDeviceNum)
426 return SCROLL_TYPE_NO_SCROLL; 425 return SCROLL_TYPE_NO_SCROLL;
427 if (!scrollclass_devices_[xievent->sourceid])
428 return SCROLL_TYPE_NO_SCROLL;
429 int horizontal_id = scroll_data_[xievent->sourceid].horizontal.number; 426 int horizontal_id = scroll_data_[xievent->sourceid].horizontal.number;
430 int vertical_id = scroll_data_[xievent->sourceid].vertical.number; 427 int vertical_id = scroll_data_[xievent->sourceid].vertical.number;
431 return (XIMaskIsSet(xievent->valuators.mask, horizontal_id) 428 return (horizontal_id != -1 &&
429 XIMaskIsSet(xievent->valuators.mask, horizontal_id)
432 ? SCROLL_TYPE_HORIZONTAL 430 ? SCROLL_TYPE_HORIZONTAL
433 : 0) | 431 : 0) |
434 (XIMaskIsSet(xievent->valuators.mask, vertical_id) 432 (vertical_id != -1 && XIMaskIsSet(xievent->valuators.mask, vertical_id)
435 ? SCROLL_TYPE_VERTICAL 433 ? SCROLL_TYPE_VERTICAL
436 : 0); 434 : 0);
437 } 435 }
438 436
439 int DeviceDataManagerX11::GetScrollClassDeviceDetail(const XEvent& xev) const { 437 int DeviceDataManagerX11::GetScrollClassDeviceDetail(const XEvent& xev) const {
440 if (xev.type != GenericEvent) 438 if (xev.type != GenericEvent)
441 return SCROLL_TYPE_NO_SCROLL; 439 return SCROLL_TYPE_NO_SCROLL;
442 440
443 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev.xcookie.data); 441 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev.xcookie.data);
444 if (xiev->sourceid >= kMaxDeviceNum || xiev->deviceid >= kMaxDeviceNum) 442 if (xiev->sourceid >= kMaxDeviceNum || xiev->deviceid >= kMaxDeviceNum)
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 info.vertical.position = 0; 788 info.vertical.position = 0;
791 info.vertical.seen = false; 789 info.vertical.seen = false;
792 break; 790 break;
793 case XIScrollTypeHorizontal: 791 case XIScrollTypeHorizontal:
794 info.horizontal.number = scroll_class_info->number; 792 info.horizontal.number = scroll_class_info->number;
795 info.horizontal.increment = scroll_class_info->increment; 793 info.horizontal.increment = scroll_class_info->increment;
796 info.horizontal.position = 0; 794 info.horizontal.position = 0;
797 info.horizontal.seen = false; 795 info.horizontal.seen = false;
798 break; 796 break;
799 } 797 }
800 scrollclass_devices_[deviceid] = true;
801 } 798 }
802 799
803 double DeviceDataManagerX11::ExtractAndUpdateScrollOffset( 800 double DeviceDataManagerX11::ExtractAndUpdateScrollOffset(
804 ScrollInfo::AxisInfo* axis, 801 ScrollInfo::AxisInfo* axis,
805 double valuator) const { 802 double valuator) const {
806 double offset = 0; 803 double offset = 0;
807 if (axis->seen) 804 if (axis->seen)
808 offset = axis->position - valuator; 805 offset = axis->position - valuator;
809 axis->seen = true; 806 axis->seen = true;
810 axis->position = valuator; 807 axis->position = valuator;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 } else { 881 } else {
885 keyboards.erase(it); 882 keyboards.erase(it);
886 ++blocked_iter; 883 ++blocked_iter;
887 } 884 }
888 } 885 }
889 // Notify base class of updated list. 886 // Notify base class of updated list.
890 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards); 887 DeviceDataManager::OnKeyboardDevicesUpdated(keyboards);
891 } 888 }
892 889
893 } // namespace ui 890 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698