Index: ui/aura/test/ui_controls_factory_aurax11.cc |
diff --git a/ui/aura/test/ui_controls_factory_aurax11.cc b/ui/aura/test/ui_controls_factory_aurax11.cc |
index 8421d00ffe911a6ed0e2641b8b73ebb316a8a7b1..628c2ae3de337107bc0dc8fec52df16a4c7674e6 100644 |
--- a/ui/aura/test/ui_controls_factory_aurax11.cc |
+++ b/ui/aura/test/ui_controls_factory_aurax11.cc |
@@ -139,21 +139,31 @@ class UIControlsX11 : public UIControlsAura { |
return SendMouseMoveNotifyWhenDone(x, y, base::Closure()); |
} |
virtual bool SendMouseMoveNotifyWhenDone( |
- long x, |
- long y, |
+ long root_x, |
sadrul
2014/02/14 19:18:10
The desktop version calls this screen_x, screen_y
pkotwicz
2014/02/14 19:57:18
Root window coordinates are passed in. The documen
|
+ long root_y, |
const base::Closure& closure) OVERRIDE { |
- XEvent xevent = {0}; |
- XMotionEvent* xmotion = &xevent.xmotion; |
- xmotion->type = MotionNotify; |
- gfx::Point point = ui::ConvertPointToPixel( |
- root_window_->window()->layer(), |
- gfx::Point(static_cast<int>(x), static_cast<int>(y))); |
- xmotion->x = point.x(); |
- xmotion->y = point.y(); |
- xmotion->state = button_down_mask; |
- xmotion->same_screen = True; |
- // RootWindow will take care of other necessary fields. |
- root_window_->host()->PostNativeEvent(&xevent); |
+ gfx::Point root_location(static_cast<int>(root_x), |
+ static_cast<int>(root_y)); |
+ |
+ gfx::Point root_current_location; |
+ root_window_->host()->QueryMouseLocation(&root_current_location); |
+ root_window_->host()->ConvertPointFromHost(&root_current_location); |
+ |
+ if (root_location != root_current_location && button_down_mask == 0) { |
+ // Move the cursor because EnterNotify/LeaveNotify are generated with the |
+ // current mouse position as a result of XGrabPointer() |
+ root_window_->MoveCursorTo(root_location); |
+ } else { |
+ XEvent xevent = {0}; |
+ XMotionEvent* xmotion = &xevent.xmotion; |
+ xmotion->type = MotionNotify; |
+ xmotion->x = root_location.x(); |
+ xmotion->y = root_location.y(); |
+ xmotion->state = button_down_mask; |
+ xmotion->same_screen = True; |
+ // RootWindow will take care of other necessary fields. |
+ root_window_->host()->PostNativeEvent(&xevent); |
+ } |
RunClosureAfterAllPendingUIEvents(closure); |
return true; |
} |