| Index: ui/events/ozone/evdev/input_controller_evdev.cc
|
| diff --git a/ui/events/ozone/evdev/input_controller_evdev.cc b/ui/events/ozone/evdev/input_controller_evdev.cc
|
| index 65ca67ec8cc4ebd86ff926c4fc819b87851ae2ce..32c558e0da47e19129bf94d4830715367b142e85 100644
|
| --- a/ui/events/ozone/evdev/input_controller_evdev.cc
|
| +++ b/ui/events/ozone/evdev/input_controller_evdev.cc
|
| @@ -4,9 +4,11 @@
|
|
|
| #include "ui/events/ozone/evdev/input_controller_evdev.h"
|
|
|
| +#include <algorithm>
|
| #include <linux/input.h>
|
| #include <vector>
|
|
|
| +#include "base/strings/stringprintf.h"
|
| #include "ui/events/ozone/evdev/event_factory_evdev.h"
|
| #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
|
|
|
| @@ -40,6 +42,45 @@ void SetGestureBoolProperty(GesturePropertyProvider* provider,
|
| property->SetBoolValue(values);
|
| }
|
| }
|
| +
|
| +// Return the values in an array in one string. Used for touch logging.
|
| +template <typename T>
|
| +std::string DumpArrayProperty(const std::vector<T>& value, const char* format) {
|
| + std::string ret;
|
| + for (size_t i = 0; i < value.size(); ++i) {
|
| + if (i > 0)
|
| + ret.append(", ");
|
| + ret.append(base::StringPrintf(format, value[i]));
|
| + }
|
| + return ret;
|
| +}
|
| +
|
| +// Return the values in a gesture property in one string. Used for touch
|
| +// logging.
|
| +std::string DumpGesturePropertyValue(GesturesProp* property) {
|
| + switch (property->type()) {
|
| + case GesturePropertyProvider::PT_INT:
|
| + return DumpArrayProperty(property->GetIntValue(), "%d");
|
| + break;
|
| + case GesturePropertyProvider::PT_SHORT:
|
| + return DumpArrayProperty(property->GetShortValue(), "%d");
|
| + break;
|
| + case GesturePropertyProvider::PT_BOOL:
|
| + return DumpArrayProperty(property->GetBoolValue(), "%d");
|
| + break;
|
| + case GesturePropertyProvider::PT_STRING:
|
| + return "\"" + property->GetStringValue() + "\"";
|
| + break;
|
| + case GesturePropertyProvider::PT_REAL:
|
| + return DumpArrayProperty(property->GetDoubleValue(), "%lf");
|
| + break;
|
| + default:
|
| + NOTREACHED();
|
| + break;
|
| + }
|
| + return std::string();
|
| +}
|
| +
|
| #endif
|
|
|
| } // namespace
|
| @@ -184,4 +225,37 @@ void InputControllerEvdev::SetTapToClickPaused(bool state) {
|
| SetBoolPropertyForOneType(DT_TOUCHPAD, "Tap Paused", state);
|
| }
|
|
|
| +std::string InputControllerEvdev::GetGestureDeviceStatus() {
|
| + std::string ret;
|
| +#if defined(USE_EVDEV_GESTURES)
|
| + // We use DT_ALL since we want gesture property values for all devices that
|
| + // run with the gesture library, not just mice or touchpads.
|
| + std::vector<int> ids;
|
| + event_factory_->GetDeviceIdsByType(DT_ALL, &ids);
|
| +
|
| + // Dump the property names and values for each device.
|
| + for (size_t i = 0; i < ids.size(); ++i) {
|
| + std::vector<std::string> names =
|
| + gesture_property_provider_->GetPropertyNamesById(ids[i]);
|
| + ret.append("\n");
|
| + ret.append(base::StringPrintf("ID %d:\n", ids[i]));
|
| + ret.append(base::StringPrintf(
|
| + "Device \'%s\':\n",
|
| + gesture_property_provider_->GetDeviceNameById(ids[i]).c_str()));
|
| +
|
| + // Note that, unlike X11, we don't maintain the "atom" concept here.
|
| + // Therefore, the property name indices we output here shouldn't be treated
|
| + // as unique identifiers of the properties.
|
| + std::sort(names.begin(), names.end());
|
| + for (size_t j = 0; j < names.size(); ++j) {
|
| + ret.append(base::StringPrintf("\t%s (%lu):", names[j].c_str(), j));
|
| + GesturesProp* property =
|
| + gesture_property_provider_->GetProperty(ids[i], names[j]);
|
| + ret.append("\t" + DumpGesturePropertyValue(property) + '\n');
|
| + }
|
| + }
|
| +#endif
|
| + return ret;
|
| +}
|
| +
|
| } // namespace ui
|
|
|