| 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 db6ff96389a81d25dbd955212307847e804dd111..23a7922434dd56109dba33f2bc2eaa2c8614e3c5 100644
|
| --- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc
|
| +++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc
|
| @@ -165,24 +165,37 @@ class UIControlsDesktopX11 : public UIControlsAura {
|
| long screen_x,
|
| long screen_y,
|
| const base::Closure& closure) OVERRIDE {
|
| - gfx::Point screen_point(screen_x, screen_y);
|
| - gfx::Point root_point = screen_point;
|
| - aura::Window* root_window = RootWindowForPoint(screen_point);
|
| + gfx::Point screen_location(screen_x, screen_y);
|
| + gfx::Point root_location = screen_location;
|
| + aura::Window* root_window = RootWindowForPoint(screen_location);
|
|
|
| aura::client::ScreenPositionClient* screen_position_client =
|
| aura::client::GetScreenPositionClient(root_window);
|
| - if (screen_position_client)
|
| - screen_position_client->ConvertPointFromScreen(root_window, &root_point);
|
| + if (screen_position_client) {
|
| + screen_position_client->ConvertPointFromScreen(root_window,
|
| + &root_location);
|
| + }
|
|
|
| - 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.
|
| - root_window->GetDispatcher()->host()->PostNativeEvent(&xevent);
|
| + 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_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.
|
| + dispatcher->host()->PostNativeEvent(&xevent);
|
| + }
|
| RunClosureAfterAllPendingUIEvents(closure);
|
| return true;
|
| }
|
|
|