Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: ui/views/test/ui_controls_factory_desktop_aurax11.cc

Issue 149743006: Fix crash of OmniboxViewViewsTest.SelectAllOnClick on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
« ui/aura/test/ui_controls_factory_aurax11.cc ('K') | « ui/aura/test/ui_controls_factory_aurax11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698