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 <gestures/gestures.h> | 7 #include <gestures/gestures.h> |
8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
9 | 9 |
10 #include <fnmatch.h> | 10 #include <fnmatch.h> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 #include <string.h> | 12 #include <string.h> |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
16 #include "base/files/file_enumerator.h" | 16 #include "base/files/file_enumerator.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" |
21 #include "base/strings/string_tokenizer.h" | 21 #include "base/strings/string_tokenizer.h" |
22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
23 #include "base/strings/stringize_macros.h" | 23 #include "base/strings/stringize_macros.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "ui/events/ozone/evdev/libgestures_glue/gesture_feedback.h" |
25 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 26 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
26 | 27 |
27 // Severity level for general info logging purpose. | 28 // Severity level for general info logging purpose. |
28 #define GPROP_LOG DVLOG | 29 #define GPROP_LOG DVLOG |
29 #define INFO_SEVERITY 1 | 30 #define INFO_SEVERITY 1 |
30 | 31 |
31 // GesturesProp implementation. | 32 // GesturesProp implementation. |
32 // | 33 // |
33 // Check the header file for its definition. | 34 // Check the header file for its definition. |
34 GesturesProp::GesturesProp(const std::string& name, | 35 GesturesProp::GesturesProp(const std::string& name, |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 TYPE_CASE(PT_STRING); | 550 TYPE_CASE(PT_STRING); |
550 TYPE_CASE(PT_REAL); | 551 TYPE_CASE(PT_REAL); |
551 default: | 552 default: |
552 NOTREACHED(); | 553 NOTREACHED(); |
553 break; | 554 break; |
554 } | 555 } |
555 #undef TYPE_CASE | 556 #undef TYPE_CASE |
556 return out << s; | 557 return out << s; |
557 } | 558 } |
558 | 559 |
| 560 // A relay function that dumps evdev log to a place that we have access to |
| 561 // (the default directory is inaccessible without X11). |
| 562 void DumpTouchEvdevDebugLog(void* data) { |
| 563 Event_Dump_Debug_Log_To(data, ui::kTouchpadEvdevLogPath); |
| 564 } |
| 565 |
559 } // namespace | 566 } // namespace |
560 | 567 |
561 // GesturesProp logging function. | 568 // GesturesProp logging function. |
562 std::ostream& operator<<(std::ostream& os, const GesturesProp& prop) { | 569 std::ostream& operator<<(std::ostream& os, const GesturesProp& prop) { |
563 const GesturesProp* property = ∝ | 570 const GesturesProp* property = ∝ |
564 | 571 |
565 // Output the property content. | 572 // Output the property content. |
566 os << "\"" << property->name() << "\", " << property->type() << ", " | 573 os << "\"" << property->name() << "\", " << property->type() << ", " |
567 << property->count() << ", (" << property->IsAllocated() << ", " | 574 << property->count() << ", (" << property->IsAllocated() << ", " |
568 << property->IsReadOnly() << "), "; | 575 << property->IsReadOnly() << "), "; |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 Event_Get_Orientation_Minimum(device)); | 1426 Event_Get_Orientation_Minimum(device)); |
1420 CreateIntSingle(device_data, | 1427 CreateIntSingle(device_data, |
1421 "Orientation Maximum", | 1428 "Orientation Maximum", |
1422 &properties->orientation_maximum, | 1429 &properties->orientation_maximum, |
1423 Event_Get_Orientation_Maximum(device)); | 1430 Event_Get_Orientation_Maximum(device)); |
1424 | 1431 |
1425 // Log dump property. Will call Event_Dump_Debug_Log when its value is being | 1432 // Log dump property. Will call Event_Dump_Debug_Log when its value is being |
1426 // set. | 1433 // set. |
1427 GesturesProp* dump_debug_log_prop = CreateBoolSingle( | 1434 GesturesProp* dump_debug_log_prop = CreateBoolSingle( |
1428 device_data, "Dump Debug Log", &properties->dump_debug_log, false); | 1435 device_data, "Dump Debug Log", &properties->dump_debug_log, false); |
1429 RegisterHandlers( | 1436 RegisterHandlers(device_data, dump_debug_log_prop, device, NULL, |
1430 device_data, dump_debug_log_prop, device, NULL, Event_Dump_Debug_Log); | 1437 DumpTouchEvdevDebugLog); |
1431 | 1438 |
1432 // Whether to do the gesture recognition or just passing the multi-touch data | 1439 // Whether to do the gesture recognition or just passing the multi-touch data |
1433 // to upper layers. | 1440 // to upper layers. |
1434 CreateBoolSingle(device_data, | 1441 CreateBoolSingle(device_data, |
1435 "Raw Touch Passthrough", | 1442 "Raw Touch Passthrough", |
1436 &properties->raw_passthrough, | 1443 &properties->raw_passthrough, |
1437 false); | 1444 false); |
1438 return true; | 1445 return true; |
1439 } | 1446 } |
1440 | 1447 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 const GesturesPropProvider kGesturePropProvider = { | 1547 const GesturesPropProvider kGesturePropProvider = { |
1541 GesturesPropFunctionsWrapper::CreateInt, | 1548 GesturesPropFunctionsWrapper::CreateInt, |
1542 GesturesPropFunctionsWrapper::CreateShort, | 1549 GesturesPropFunctionsWrapper::CreateShort, |
1543 GesturesPropFunctionsWrapper::CreateBool, | 1550 GesturesPropFunctionsWrapper::CreateBool, |
1544 GesturesPropFunctionsWrapper::CreateString, | 1551 GesturesPropFunctionsWrapper::CreateString, |
1545 GesturesPropFunctionsWrapper::CreateReal, | 1552 GesturesPropFunctionsWrapper::CreateReal, |
1546 GesturesPropFunctionsWrapper::RegisterHandlers, | 1553 GesturesPropFunctionsWrapper::RegisterHandlers, |
1547 GesturesPropFunctionsWrapper::Free}; | 1554 GesturesPropFunctionsWrapper::Free}; |
1548 | 1555 |
1549 } // namespace ui | 1556 } // namespace ui |
OLD | NEW |