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

Unified Diff: ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc

Issue 902543002: Honor device type properties in gesture_property_provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc
index 766ffb25ea019179d493f621b96461821ad7d16c..8056539fc5eb750f93e1ac954014f806954a89fb 100644
--- a/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc
+++ b/ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc
@@ -431,30 +431,47 @@ const char* kFalse[] = {"off", "false", "no"};
// Check if a device falls into one device type category.
bool IsDeviceOfType(const ui::GesturePropertyProvider::DevicePtr device,
- const ui::EventDeviceType type) {
+ const ui::EventDeviceType type,
+ const GesturesProp* device_mouse,
spang 2015/02/04 17:47:10 device_mouse_property
Shecky Lin 2015/02/06 04:51:14 Done.
+ const GesturesProp* device_touchpad) {
spang 2015/02/04 17:47:10 device_touchpad_property
Shecky Lin 2015/02/06 04:51:14 Done.
+ // Get the device type info from gesture properties if they are available.
+ bool is_mouse = false, is_touchpad = false;
+ if (device_mouse)
+ is_mouse = device_mouse->GetBoolValue()[0];
spang 2015/02/04 17:47:10 else is_mouse = (evdev_class == EvdevClassMouse
Shecky Lin 2015/02/06 04:51:14 Done.
+ if (device_touchpad)
+ is_touchpad = device_touchpad->GetBoolValue()[0];
spang 2015/02/04 17:47:10 else is_touchpad = (evdev_class == EvdevClassTou
Shecky Lin 2015/02/06 04:51:14 Done.
+
+ // If the device type properties are unavailable, fallback to the libevdev
+ // device info.
EvdevClass evdev_class = device->info.evdev_class;
switch (type) {
case ui::DT_KEYBOARD:
return (evdev_class == EvdevClassKeyboard);
break;
case ui::DT_MOUSE:
+ if (device_mouse)
+ return is_mouse;
return (evdev_class == EvdevClassMouse ||
evdev_class == EvdevClassMultitouchMouse);
break;
case ui::DT_TOUCHPAD:
- // Note that the behavior here is different from the inputcontrol script
- // which actually returns touchscreen devices as well.
+ if (device_mouse && device_mouse)
+ return (!is_mouse) && is_touchpad;
return (evdev_class == EvdevClassTouchpad);
break;
case ui::DT_TOUCHSCREEN:
return (evdev_class == EvdevClassTouchscreen);
break;
case ui::DT_MULTITOUCH:
+ if (device_touchpad)
+ return is_touchpad;
return (evdev_class == EvdevClassTouchpad ||
evdev_class == EvdevClassTouchscreen ||
evdev_class == EvdevClassMultitouchMouse);
break;
case ui::DT_MULTITOUCH_MOUSE:
+ if (device_mouse && device_mouse)
+ return is_mouse && is_touchpad;
return (evdev_class == EvdevClassMultitouchMouse);
break;
case ui::DT_ALL:
@@ -855,7 +872,7 @@ bool GesturePropertyProvider::GetDeviceIdsByType(
bool exists = false;
DeviceMap::const_iterator it = device_map_.begin();
for (; it != device_map_.end(); ++it) {
- if (IsDeviceOfType(it->second, type)) {
+ if (IsDeviceIdOfType(it->first, type)) {
exists = true;
if (device_ids)
device_ids->push_back(it->first);
@@ -869,7 +886,9 @@ bool GesturePropertyProvider::IsDeviceIdOfType(const DeviceId device_id,
DeviceMap::const_iterator it = device_map_.find(device_id);
if (it == device_map_.end())
return false;
- return IsDeviceOfType(it->second, type);
+ return IsDeviceOfType(it->second, type,
+ GetProperty(device_id, "Device Mouse"),
+ GetProperty(device_id, "Device Touchpad"));
}
GesturesProp* GesturePropertyProvider::GetProperty(const DeviceId device_id,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698