summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 13:54:49 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-27 13:54:49 +0000
commitdb8eaf23369e685f70a53a492baa2e22769db75a (patch)
tree8a0629d91993c649169e1024ab0e741c420294ba
parentebb5b98a57bea3e2dd21aa084788f894a3d5239e (diff)
downloadchromium_src-db8eaf23369e685f70a53a492baa2e22769db75a.zip
chromium_src-db8eaf23369e685f70a53a492baa2e22769db75a.tar.gz
chromium_src-db8eaf23369e685f70a53a492baa2e22769db75a.tar.bz2
Fix bugs in ui_controls::SendMouseMove on linux. I believe the
coordinates of the mouse event were run. I'm also making the code wait for a mouse motion. BUG=none TEST=none R=estade@chromium.org Review URL: http://codereview.chromium.org/7495039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94285 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/ui_controls_linux.cc18
-rw-r--r--chrome/browser/ui/views/button_dropdown_test.cc4
2 files changed, 10 insertions, 12 deletions
diff --git a/chrome/browser/automation/ui_controls_linux.cc b/chrome/browser/automation/ui_controls_linux.cc
index 90b69ea..9c80f59 100644
--- a/chrome/browser/automation/ui_controls_linux.cc
+++ b/chrome/browser/automation/ui_controls_linux.cc
@@ -77,12 +77,12 @@ void FakeAMouseMotionEvent(gint x, gint y) {
event->motion.window = gdk_window_at_pointer(&x, &y);
}
g_object_ref(event->motion.window);
- event->motion.x = x;
- event->motion.y = y;
- gint origin_x, origin_y;
- gdk_window_get_origin(event->motion.window, &origin_x, &origin_y);
- event->motion.x_root = x + origin_x;
- event->motion.y_root = y + origin_y;
+ gint window_x, window_y;
+ gdk_window_get_origin(event->motion.window, &window_x, &window_y);
+ event->motion.x = x - window_x;
+ event->motion.y = y - window_y;
+ event->motion.x_root = x;
+ event->motion.y_root = y;
event->motion.device = gdk_device_get_core_pointer();
event->type = GDK_MOTION_NOTIFY;
@@ -170,11 +170,7 @@ bool SendMouseMove(long x, long y) {
bool SendMouseMoveNotifyWhenDone(long x, long y, Task* task) {
bool rv = SendMouseMove(x, y);
- // We can't rely on any particular event signalling the completion of the
- // mouse move. Posting the task to the message loop hopefully guarantees
- // the pointer has moved before task is run (although it may not run it as
- // soon as it could).
- MessageLoop::current()->PostTask(FROM_HERE, task);
+ new EventWaiter(task, GDK_MOTION_NOTIFY, 1);
return rv;
}
diff --git a/chrome/browser/ui/views/button_dropdown_test.cc b/chrome/browser/ui/views/button_dropdown_test.cc
index 93a8cde..d0650452 100644
--- a/chrome/browser/ui/views/button_dropdown_test.cc
+++ b/chrome/browser/ui/views/button_dropdown_test.cc
@@ -81,8 +81,10 @@ class ButtonDropDownDragTest : public ViewEventTestBase,
// Drag to invoke the menu.
gfx::Point view_center;
views::View::ConvertPointToScreen(button_, &view_center);
+ // The 50 is a bit arbitrary. We just need a value greater than the drag
+ // threshold.
ui_controls::SendMouseMoveNotifyWhenDone(
- view_center.x(), view_center.y() + button_->height(),
+ view_center.x(), view_center.y() + 50,
CreateEventTask(this, &ButtonDropDownDragTest::Step2));
}