Index: ui/views/test/ui_controls_factory_desktop_aurax11.cc |
diff --git a/ui/views/test/ui_controls_factory_desktop_aurax11.cc b/ui/views/test/ui_controls_factory_desktop_aurax11.cc |
index 6db2e4a4c63bb955080348268bea9899b7db495d..d745d9eec2778ee35ee8257fb5ba65337293c72f 100644 |
--- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc |
+++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc |
@@ -163,29 +163,38 @@ class UIControlsDesktopX11 : public UIControlsAura { |
return SendMouseMoveNotifyWhenDone(x, y, base::Closure()); |
} |
virtual bool SendMouseMoveNotifyWhenDone( |
- long x, |
- long y, |
+ long screen_x, |
+ long screen_y, |
const base::Closure& closure) OVERRIDE { |
- gfx::Point screen_point(x, y); |
- gfx::Point window_point = screen_point; |
+ gfx::Point screen_point(screen_x, screen_y); |
+ gfx::Point root_point = screen_point; |
aura::Window* root_window = RootWindowForPoint(screen_point); |
aura::client::ScreenPositionClient* screen_position_client = |
aura::client::GetScreenPositionClient(root_window); |
- if (screen_position_client) { |
- screen_position_client->ConvertPointFromScreen(root_window, |
- &window_point); |
+ if (screen_position_client) |
+ screen_position_client->ConvertPointFromScreen(root_window, &root_point); |
+ |
+ aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); |
+ gfx::Point root_current_location; |
+ dispatcher->host()->QueryMouseLocation(&root_current_location); |
+ dispatcher->host()->ConvertPointFromHost(&root_current_location); |
+ |
+ if (root_point != 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() |
+ dispatcher->MoveCursorTo(root_point); |
+ } else { |
+ XEvent xevent = {0}; |
+ XMotionEvent* xmotion = &xevent.xmotion; |
+ xmotion->type = MotionNotify; |
+ xmotion->x = root_point.x(); |
+ xmotion->y = root_point.y(); |
+ xmotion->state = button_down_mask; |
+ xmotion->same_screen = True; |
+ // RootWindow will take care of other necessary fields. |
+ dispatcher->host()->PostNativeEvent(&xevent); |
} |
- |
- XEvent xevent = {0}; |
- XMotionEvent* xmotion = &xevent.xmotion; |
- xmotion->type = MotionNotify; |
- xmotion->x = window_point.x(); |
- xmotion->y = window_point.y(); |
- xmotion->state = button_down_mask; |
- xmotion->same_screen = True; |
- // RootWindow will take care of other necessary fields. |
- root_window->GetDispatcher()->host()->PostNativeEvent(&xevent); |
RunClosureAfterAllPendingUIEvents(closure); |
return true; |
} |