| OLD | NEW |
| 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/ozone/evdev/libgestures_glue/gesture_property_provider.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" |
| 6 | 6 |
| 7 #include <fnmatch.h> | 7 #include <fnmatch.h> |
| 8 #include <gestures/gestures.h> | 8 #include <gestures/gestures.h> |
| 9 #include <libevdev/libevdev.h> | 9 #include <libevdev/libevdev.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 // ignored. | 1029 // ignored. |
| 1030 // 2. Each entry takes up one and exactly one line in the file. | 1030 // 2. Each entry takes up one and exactly one line in the file. |
| 1031 // 3. No negation of the option value even if the option name is prefixed with | 1031 // 3. No negation of the option value even if the option name is prefixed with |
| 1032 // "No" as it may cause problems for option names that does start with "No" | 1032 // "No" as it may cause problems for option names that does start with "No" |
| 1033 // (e.g., "Non-linearity"). | 1033 // (e.g., "Non-linearity"). |
| 1034 | 1034 |
| 1035 // Break the content into sections, lines and then pieces. | 1035 // Break the content into sections, lines and then pieces. |
| 1036 // Sections are delimited by the "EndSection" keyword. | 1036 // Sections are delimited by the "EndSection" keyword. |
| 1037 // Lines are delimited by "\n". | 1037 // Lines are delimited by "\n". |
| 1038 // Pieces are delimited by all white-spaces. | 1038 // Pieces are delimited by all white-spaces. |
| 1039 std::vector<std::string> sections; | 1039 for (const std::string& section : |
| 1040 base::SplitStringUsingSubstr(content, "EndSection", §ions); | 1040 base::SplitStringUsingSubstr(content, "EndSection", |
| 1041 for (size_t i = 0; i < sections.size(); ++i) { | 1041 base::TRIM_WHITESPACE, |
| 1042 base::SPLIT_WANT_ALL)) { |
| 1042 // Create a new configuration section. | 1043 // Create a new configuration section. |
| 1043 configurations_.push_back( | 1044 configurations_.push_back( |
| 1044 base::MakeUnique<internal::ConfigurationSection>()); | 1045 base::MakeUnique<internal::ConfigurationSection>()); |
| 1045 internal::ConfigurationSection* config = configurations_.back().get(); | 1046 internal::ConfigurationSection* config = configurations_.back().get(); |
| 1046 | 1047 |
| 1047 // Break the section into lines. | 1048 // Break the section into lines. |
| 1048 base::StringTokenizer lines(sections[i], "\n"); | 1049 base::StringTokenizer lines(section, "\n"); |
| 1049 bool is_input_class_section = true; | 1050 bool is_input_class_section = true; |
| 1050 bool has_checked_section_type = false; | 1051 bool has_checked_section_type = false; |
| 1051 while (is_input_class_section && lines.GetNext()) { | 1052 while (is_input_class_section && lines.GetNext()) { |
| 1052 // Parse the line w.r.t. the xorg-conf format. | 1053 // Parse the line w.r.t. the xorg-conf format. |
| 1053 std::string line(lines.token()); | 1054 std::string line(lines.token()); |
| 1054 | 1055 |
| 1055 // Skip empty lines. | 1056 // Skip empty lines. |
| 1056 if (line.empty()) | 1057 if (line.empty()) |
| 1057 continue; | 1058 continue; |
| 1058 | 1059 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 const GesturesPropProvider kGesturePropProvider = { | 1546 const GesturesPropProvider kGesturePropProvider = { |
| 1546 GesturesPropFunctionsWrapper::CreateInt, | 1547 GesturesPropFunctionsWrapper::CreateInt, |
| 1547 GesturesPropFunctionsWrapper::CreateShort, | 1548 GesturesPropFunctionsWrapper::CreateShort, |
| 1548 GesturesPropFunctionsWrapper::CreateBool, | 1549 GesturesPropFunctionsWrapper::CreateBool, |
| 1549 GesturesPropFunctionsWrapper::CreateString, | 1550 GesturesPropFunctionsWrapper::CreateString, |
| 1550 GesturesPropFunctionsWrapper::CreateReal, | 1551 GesturesPropFunctionsWrapper::CreateReal, |
| 1551 GesturesPropFunctionsWrapper::RegisterHandlers, | 1552 GesturesPropFunctionsWrapper::RegisterHandlers, |
| 1552 GesturesPropFunctionsWrapper::Free}; | 1553 GesturesPropFunctionsWrapper::Free}; |
| 1553 | 1554 |
| 1554 } // namespace ui | 1555 } // namespace ui |
| OLD | NEW |