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

Side by Side Diff: ui/events/ozone/evdev/event_device_test_util.cc

Issue 1037843003: ozone: evdev: Allow setting slot values in EventDeviceInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: define ABS_MT_TOOL_Y if missing Created 5 years, 8 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 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
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
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_device_info.cc ('k') | ui/events/ozone/evdev/touch_event_converter_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698