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

Unified Diff: ui/events/x/events_x.cc

Issue 412553005: Scale touch event radius (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 6 years, 5 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 | « ui/events/x/device_data_manager_x11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/events_x.cc
diff --git a/ui/events/x/events_x.cc b/ui/events/x/events_x.cc
index c9780ece12c93e45bfd00931e3b3e98d73e1ddc3..419f4260a8bce4e2d01a0c7f6e596cc941a24cda 100644
--- a/ui/events/x/events_x.cc
+++ b/ui/events/x/events_x.cc
@@ -286,6 +286,13 @@ double GetTouchParamFromXEvent(XEvent* xev,
return default_value;
}
+void ScaleTouchRadius(XEvent* xev, double* radius) {
+ DCHECK_EQ(GenericEvent, xev->type);
+ XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data);
+ ui::DeviceDataManagerX11::GetInstance()->ApplyTouchRadiusScale(
+ xiev->sourceid, radius);
+}
+
} // namespace
namespace ui {
@@ -704,13 +711,17 @@ int GetTouchId(const base::NativeEvent& xev) {
}
float GetTouchRadiusX(const base::NativeEvent& native_event) {
- return GetTouchParamFromXEvent(native_event,
+ double radius = GetTouchParamFromXEvent(native_event,
ui::DeviceDataManagerX11::DT_TOUCH_MAJOR, 0.0) / 2.0;
+ ScaleTouchRadius(native_event, &radius);
+ return radius;
}
float GetTouchRadiusY(const base::NativeEvent& native_event) {
- return GetTouchParamFromXEvent(native_event,
+ double radius = GetTouchParamFromXEvent(native_event,
ui::DeviceDataManagerX11::DT_TOUCH_MINOR, 0.0) / 2.0;
+ ScaleTouchRadius(native_event, &radius);
+ return radius;
}
float GetTouchAngle(const base::NativeEvent& native_event) {
« no previous file with comments | « ui/events/x/device_data_manager_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698