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..c14f79d5189dc10abc10d035f3cb07b86387a930 100644 |
--- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc |
+++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc |
@@ -167,25 +167,38 @@ class UIControlsDesktopX11 : public UIControlsAura { |
long y, |
const base::Closure& closure) OVERRIDE { |
gfx::Point screen_point(x, y); |
- gfx::Point window_point = screen_point; |
+ 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) { |
+ // Move the cursor because EnterNotify/LeaveNotify are generated with the |
+ // current mouse position as a result of XGrabPointer() |
+ dispatcher->MoveCursorTo(root_point); |
+ |
+ // MoveCursorTo() always generates a mouse move event. The test's |
+ // intention may be to generate a mouse drag event so dispatch an event |
+ // with the correct XMotionEvent state below. |
} |
XEvent xevent = {0}; |
XMotionEvent* xmotion = &xevent.xmotion; |
xmotion->type = MotionNotify; |
- xmotion->x = window_point.x(); |
- xmotion->y = window_point.y(); |
+ 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); |
+ dispatcher->host()->PostNativeEvent(&xevent); |
sadrul
2014/02/11 19:09:37
We are potentially sending two mouse-move events h
|
RunClosureAfterAllPendingUIEvents(closure); |
return true; |
} |