OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ozone/evdev/event_device_test_util.h" | 5 #include "ui/events/ozone/evdev/event_device_test_util.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 std::vector<unsigned long> prop_bits; | 398 std::vector<unsigned long> prop_bits; |
399 if (!ParseBitfield(capabilities.prop, INPUT_PROP_CNT, &prop_bits)) | 399 if (!ParseBitfield(capabilities.prop, INPUT_PROP_CNT, &prop_bits)) |
400 return false; | 400 return false; |
401 devinfo->SetProps(&prop_bits[0], prop_bits.size()); | 401 devinfo->SetProps(&prop_bits[0], prop_bits.size()); |
402 | 402 |
403 for (size_t i = 0; i < capabilities.abs_axis_count; ++i) { | 403 for (size_t i = 0; i < capabilities.abs_axis_count; ++i) { |
404 const DeviceAbsoluteAxis& axis = capabilities.abs_axis[i]; | 404 const DeviceAbsoluteAxis& axis = capabilities.abs_axis[i]; |
405 devinfo->SetAbsInfo(axis.code, axis.absinfo); | 405 devinfo->SetAbsInfo(axis.code, axis.absinfo); |
406 } | 406 } |
407 | 407 |
| 408 size_t slots = devinfo->GetAbsMtSlotCount(); |
| 409 std::vector<int32_t> zero_slots(slots, 0); |
| 410 std::vector<int32_t> minus_one_slots(slots, -1); |
| 411 for (int code = EVDEV_ABS_MT_FIRST; code <= EVDEV_ABS_MT_LAST; ++code) { |
| 412 if (!devinfo->HasAbsEvent(code)) |
| 413 continue; |
| 414 if (code == ABS_MT_TRACKING_ID) |
| 415 devinfo->SetAbsMtSlots(code, minus_one_slots); |
| 416 else |
| 417 devinfo->SetAbsMtSlots(code, zero_slots); |
| 418 } |
| 419 |
408 return true; | 420 return true; |
409 } | 421 } |
410 | 422 |
411 } // namespace ui | 423 } // namespace ui |
OLD | NEW |