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

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
« ui/aura/root_window.cc ('K') | « ui/aura/test/ui_controls_factory_aurax11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« ui/aura/root_window.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