Index: ui/aura/window_tree_host_x11.cc |
diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc |
index 1421542a9d12eedafa7fd561d097273d720fbc5f..7d64fc472aa5185528237ac7bb25abcd2dc6ac26 100644 |
--- a/ui/aura/window_tree_host_x11.cc |
+++ b/ui/aura/window_tree_host_x11.cc |
@@ -808,18 +808,26 @@ void WindowTreeHostX11::DispatchXI2Event(const base::NativeEvent& event) { |
case ui::ET_TOUCH_CANCELLED: |
case ui::ET_TOUCH_RELEASED: { |
#if defined(OS_CHROMEOS) |
- // Bail out early before generating a ui::TouchEvent if this event |
- // is not within the range of this RootWindow. Converting an xevent |
- // to ui::TouchEvent might change the state of the global touch tracking |
- // state, e.g. touch release event can remove the touch id from the |
- // record, and doing this multiple time when there are multiple |
- // RootWindow will cause problem. So only generate the ui::TouchEvent |
- // when we are sure it belongs to this RootWindow. |
- if (base::SysInfo::IsRunningOnChromeOS() && |
- !bounds_.Contains(ui::EventLocationFromNative(xev))) |
+ // Bail out early before generating a ui::TouchEvent if this event is |
+ // not targeting this RootWindow. Converting an xevent to ui::TouchEvent |
+ // might change the global touch tracking state, e.g. touch release event |
+ // can remove the touch id from the record, and doing this multiple time |
+ // when there are multiple RootWindow will cause problem. |
+ // If the root window does not have a TouchCTM for the touch device where |
+ // the touch event is from, then the touch event is not intended for this |
+ // root window. |
+ XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
+ if (touch_ctm_map_.find(xiev->deviceid) == touch_ctm_map_.end()) |
sadrul
2014/03/10 20:20:12
It looks like the display-controller in ash is the
Yufeng Shen (Slow to review)
2014/03/13 20:55:46
As discussed, in the new patch I am firstly using
|
break; |
#endif // defined(OS_CHROMEOS) |
ui::TouchEvent touchev(xev); |
+#if defined(OS_CHROMEOS) |
+ TouchCTM ctm = touch_ctm_map_[xiev->deviceid]; |
+ float transformed_x = touchev.x() * ctm.x_scale + ctm.x_offset; |
+ float transformed_y = touchev.y() * ctm.y_scale + ctm.y_offset; |
+ touchev.set_location(gfx::PointF(transformed_x, transformed_y)); |
+ touchev.set_root_location(gfx::PointF(transformed_x, transformed_y)); |
+#endif // defined(OS_CHROMEOS) |
#if defined(USE_XI2_MT) |
// Ignore touch events with touch press happening on the side bezel. |
if (!IsSideBezelsEnabled()) { |